Retry aws_launch_configuration Create on 'Invalid IamInstanceProfile' error only

This commit is contained in:
zollie 2015-06-24 17:11:46 -04:00
parent 079a26a655
commit 579b33b8a2
1 changed files with 11 additions and 1 deletions

View File

@ -378,7 +378,17 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#launch-instance-with-role-console
err := resource.Retry(30*time.Second, func() error {
_, err := autoscalingconn.CreateLaunchConfiguration(&createLaunchConfigurationOpts)
return err
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Message() == "Invalid IamInstanceProfile" {
return err
}
}
return &resource.RetryError{
Err: err,
}
}
return nil
})
if err != nil {