Skip to content

Commit

Permalink
resource/aws_instance: Lower IAM instance profile retry timeout from …
Browse files Browse the repository at this point in the history
…2 minutes to 1 minute initially

Generally we would prefer to surface actual IAM issues (bad profile, etc.) sooner rather than later.
  • Loading branch information
bflad authored and drewsonne committed Mar 3, 2018
1 parent 67c4a78 commit fcb2e7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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{
Expand Down

0 comments on commit fcb2e7e

Please sign in to comment.