Fixing the flipflop problem
Actually meant as a PoC, but it works perfectly so let’s just merge this…
This commit is contained in:
parent
820476ef61
commit
ee7b33acf4
|
@ -6,6 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/hashcode"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
"github.com/mitchellh/goamz/route53"
|
"github.com/mitchellh/goamz/route53"
|
||||||
|
@ -43,10 +44,13 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
},
|
},
|
||||||
|
|
||||||
"records": &schema.Schema{
|
"records": &schema.Schema{
|
||||||
Type: schema.TypeList,
|
Type: schema.TypeSet,
|
||||||
Elem: &schema.Schema{Type: schema.TypeString},
|
Elem: &schema.Schema{Type: schema.TypeString},
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
Set: func(v interface{}) int {
|
||||||
|
return hashcode.String(v.(string))
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -151,10 +155,18 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro
|
||||||
|
|
||||||
found = true
|
found = true
|
||||||
|
|
||||||
for i, rec := range record.Records {
|
// Create an empty schema.Set to hold all found records
|
||||||
key := fmt.Sprintf("records.%d", i)
|
records := &schema.Set{
|
||||||
d.Set(key, rec)
|
F: func(v interface{}) int {
|
||||||
|
return hashcode.String(v.(string))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, rec := range record.Records {
|
||||||
|
records.Add(rec)
|
||||||
|
}
|
||||||
|
|
||||||
|
d.Set("records", records)
|
||||||
d.Set("ttl", record.TTL)
|
d.Set("ttl", record.TTL)
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue