diff --git a/CHANGELOG.md b/CHANGELOG.md index 8007669d9..6a2d7d220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,8 @@ BUG FIXES: count of instances. * providers/aws: Terraform can handle ELBs deleted manually. [GH-304] * providers/aws: Report errors properly if RDS fails to delete. [GH-310] + * providers/aws: Wait for launch configuration to exist after creation + (AWS eventual consistency) [GH-302] ## 0.2.2 (September 9, 2014) diff --git a/builtin/providers/aws/resource_aws_launch_configuration.go b/builtin/providers/aws/resource_aws_launch_configuration.go index 00590a997..001b59a90 100644 --- a/builtin/providers/aws/resource_aws_launch_configuration.go +++ b/builtin/providers/aws/resource_aws_launch_configuration.go @@ -5,8 +5,10 @@ import ( "encoding/hex" "fmt" "log" + "time" "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" "github.com/mitchellh/goamz/autoscaling" ) @@ -103,7 +105,11 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface d.SetId(d.Get("name").(string)) log.Printf("[INFO] launch configuration ID: %s", d.Id()) - return resourceAwsLaunchConfigurationRead(d, meta) + // 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() error { + return resourceAwsLaunchConfigurationRead(d, meta) + }) } func resourceAwsLaunchConfigurationDelete(d *schema.ResourceData, meta interface{}) error {