Use Schema Default declaratively instead of defaulting at each payload creation.
This commit is contained in:
parent
c2628d8fae
commit
5e2e2ffa20
|
@ -32,6 +32,7 @@ func resourceAwsRoute53Zone() *schema.Resource {
|
||||||
"comment": &schema.Schema{
|
"comment": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
Default: "Managed by Terraform",
|
||||||
},
|
},
|
||||||
|
|
||||||
"vpc_id": &schema.Schema{
|
"vpc_id": &schema.Schema{
|
||||||
|
@ -66,13 +67,9 @@ func resourceAwsRoute53Zone() *schema.Resource {
|
||||||
func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
r53 := meta.(*AWSClient).r53conn
|
r53 := meta.(*AWSClient).r53conn
|
||||||
|
|
||||||
comment := "Managed by Terraform"
|
|
||||||
if c := d.Get("comment"); c != "" {
|
|
||||||
comment = c.(string)
|
|
||||||
}
|
|
||||||
req := &route53.CreateHostedZoneInput{
|
req := &route53.CreateHostedZoneInput{
|
||||||
Name: aws.String(d.Get("name").(string)),
|
Name: aws.String(d.Get("name").(string)),
|
||||||
HostedZoneConfig: &route53.HostedZoneConfig{Comment: aws.String(comment)},
|
HostedZoneConfig: &route53.HostedZoneConfig{Comment: aws.String(d.Get("comment").(string))},
|
||||||
CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)),
|
CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)),
|
||||||
}
|
}
|
||||||
if v := d.Get("vpc_id"); v != "" {
|
if v := d.Get("vpc_id"); v != "" {
|
||||||
|
|
Loading…
Reference in New Issue