Skip to content

Commit

Permalink
Merge pull request #9781 from terraform-providers/rfd-retry-lc
Browse files Browse the repository at this point in the history
Final retry after timeout creating launch config
  • Loading branch information
ryndaniels authored Aug 20, 2019
2 parents 119ee3a + 4240a0e commit 4cd702a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion aws/resource_aws_launch_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
}
return nil
})
if isResourceTimeoutError(err) {
_, err = autoscalingconn.CreateLaunchConfiguration(&createLaunchConfigurationOpts)
}
if err != nil {
return fmt.Errorf("Error creating launch configuration: %s", err)
}
Expand All @@ -500,13 +503,20 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface

// We put a Retry here since sometimes eventual consistency bites
// us and we need to retry a few times to get the LC to load properly
return resource.Retry(30*time.Second, func() *resource.RetryError {
err = resource.Retry(30*time.Second, func() *resource.RetryError {
err := resourceAwsLaunchConfigurationRead(d, meta)
if err != nil {
return resource.RetryableError(err)
}
return nil
})
if isResourceTimeoutError(err) {
err = resourceAwsLaunchConfigurationRead(d, meta)
}
if err != nil {
return fmt.Errorf("Error reading launch configuration: %s", err)
}
return nil
}

func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}) error {
Expand Down

0 comments on commit 4cd702a

Please sign in to comment.