providers/aws: route53 record destroy in parallel works

This commit is contained in:
Mitchell Hashimoto 2014-08-31 09:12:05 -07:00
parent 52bc9a1055
commit 3a3e3346d5
2 changed files with 23 additions and 2 deletions

View File

@ -13,6 +13,7 @@ BUG FIXES:
* core: Depending on a computed variable of a list type generates a * core: Depending on a computed variable of a list type generates a
plan without failure. i.e. `${type.name.foos.0.bar}` where `foos` plan without failure. i.e. `${type.name.foos.0.bar}` where `foos`
is computed. [GH-247] is computed. [GH-247]
* providers/aws: Route53 destroys in parallel work properly. [GH-183]
## 0.2.0 (August 28, 2014) ## 0.2.0 (August 28, 2014)

View File

@ -157,10 +157,30 @@ func resource_aws_r53_record_destroy(
zone := s.Attributes["zone_id"] zone := s.Attributes["zone_id"]
log.Printf("[DEBUG] Deleting resource records for zone: %s, name: %s", log.Printf("[DEBUG] Deleting resource records for zone: %s, name: %s",
zone, s.Attributes["name"]) zone, s.Attributes["name"])
_, err = conn.ChangeResourceRecordSets(zone, req) wait := resource.StateChangeConf{
if err != nil { Pending: []string{"rejected"},
Target: "accepted",
Timeout: 5 * time.Minute,
MinTimeout: 1 * time.Second,
Refresh: func() (interface{}, string, error) {
_, err := conn.ChangeResourceRecordSets(zone, req)
if err != nil {
if strings.Contains(err.Error(), "PriorRequestNotComplete") {
// There is some pending operation, so just retry
// in a bit.
return nil, "rejected", nil
}
return nil, "failure", err
}
return nil, "accepted", nil
},
}
if _, err := wait.WaitForState(); err != nil {
return err return err
} }
return nil return nil
} }