From 4240a0e1bc808638deb04e58ce0dbc7c66236435 Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Thu, 15 Aug 2019 13:06:48 +0200 Subject: [PATCH] Final retry after timeout creating launch config --- aws/resource_aws_launch_configuration.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_launch_configuration.go b/aws/resource_aws_launch_configuration.go index d26f1303ae8..90a1dd1643c 100644 --- a/aws/resource_aws_launch_configuration.go +++ b/aws/resource_aws_launch_configuration.go @@ -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) } @@ -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 {