Skip to content

Commit

Permalink
Final retry after timeout creating launch config
Browse files Browse the repository at this point in the history
  • Loading branch information
ryndaniels committed Aug 15, 2019
1 parent 5f9aaa4 commit 4240a0e
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 4240a0e

Please sign in to comment.