diff --git a/builtin/providers/aws/resource_aws_route53_zone.go b/builtin/providers/aws/resource_aws_route53_zone.go index 6d6f6782af..1704c83555 100644 --- a/builtin/providers/aws/resource_aws_route53_zone.go +++ b/builtin/providers/aws/resource_aws_route53_zone.go @@ -35,6 +35,11 @@ func resourceAwsRoute53Zone() *schema.Resource { ForceNew: true, }, + "comment": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + }, + "vpc_region": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -61,10 +66,13 @@ func resourceAwsRoute53Zone() *schema.Resource { func resourceAwsRoute53ZoneCreate(d *schema.ResourceData, meta interface{}) error { r53 := meta.(*AWSClient).r53conn - comment := &route53.HostedZoneConfig{Comment: aws.String("Managed by Terraform")} + comment := "Managed by Terraform" + if c := d.Get("comment"); c != "" { + comment = c.(string) + } req := &route53.CreateHostedZoneInput{ Name: aws.String(d.Get("name").(string)), - HostedZoneConfig: comment, + HostedZoneConfig: &route53.HostedZoneConfig{Comment: aws.String(comment)}, CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)), } if v := d.Get("vpc_id"); v != "" { diff --git a/builtin/providers/aws/resource_aws_route53_zone_test.go b/builtin/providers/aws/resource_aws_route53_zone_test.go index 6009093d68..e4070794c0 100644 --- a/builtin/providers/aws/resource_aws_route53_zone_test.go +++ b/builtin/providers/aws/resource_aws_route53_zone_test.go @@ -203,6 +203,12 @@ func testAccCheckRoute53ZoneExistsWithProvider(s *terraform.State, n string, zon return fmt.Errorf("Hosted zone err: %v", err) } + aws_comment := *resp.HostedZone.Config.Comment + rs_comment := rs.Primary.Attributes["comment"] + if rs_comment != "" && rs_comment != aws_comment { + return fmt.Errorf("Hosted zone with comment '%s' found but does not match '%s'", aws_comment, rs_comment) + } + if !*resp.HostedZone.Config.PrivateZone { sorted_ns := make([]string, len(resp.DelegationSet.NameServers)) for i, ns := range resp.DelegationSet.NameServers { @@ -272,6 +278,7 @@ func testAccLoadTagsR53(zone *route53.GetHostedZoneOutput, td *route53.ResourceT const testAccRoute53ZoneConfig = ` resource "aws_route53_zone" "main" { name = "hashicorp.com" + comment = "Custom comment" tags { foo = "bar"