providers/aws: wait for LC to exist [GH-302]

This commit is contained in:
Mitchell Hashimoto 2014-10-11 12:27:23 -07:00
parent 129771df17
commit bd0cf94e89
2 changed files with 9 additions and 1 deletions

View File

@ -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)

View File

@ -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 {