From fcb2e7ee913e1db22150fefe624e16476760374f Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Thu, 18 Jan 2018 12:06:44 -0500 Subject: [PATCH] resource/aws_instance: Lower IAM instance profile retry timeout from 2 minutes to 1 minute initially Generally we would prefer to surface actual IAM issues (bad profile, etc.) sooner rather than later. --- aws/resource_aws_instance.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_instance.go b/aws/resource_aws_instance.go index b2f32997358..29024e1ebc5 100644 --- a/aws/resource_aws_instance.go +++ b/aws/resource_aws_instance.go @@ -822,7 +822,7 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { if _, ok := d.GetOk("iam_instance_profile"); ok { // Does not have an Iam Instance Profile associated with it, need to associate if len(resp.IamInstanceProfileAssociations) == 0 { - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(1*time.Minute, func() *resource.RetryError { _, err := conn.AssociateIamInstanceProfile(&ec2.AssociateIamInstanceProfileInput{ InstanceId: aws.String(d.Id()), IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ @@ -845,7 +845,7 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error { // Has an Iam Instance Profile associated with it, need to replace the association associationId := resp.IamInstanceProfileAssociations[0].AssociationId - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(1*time.Minute, func() *resource.RetryError { _, err := conn.ReplaceIamInstanceProfileAssociation(&ec2.ReplaceIamInstanceProfileAssociationInput{ AssociationId: associationId, IamInstanceProfile: &ec2.IamInstanceProfileSpecification{