Merge pull request #2039 from stephenchu/master
Added support for 'comment' field for an AWS route53 zone resource.
This commit is contained in:
commit
11f67ddc39
|
@ -29,6 +29,12 @@ func resourceAwsRoute53Zone() *schema.Resource {
|
|||
ForceNew: true,
|
||||
},
|
||||
|
||||
"comment": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "Managed by Terraform",
|
||||
},
|
||||
|
||||
"vpc_id": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
|
@ -61,10 +67,9 @@ 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")}
|
||||
req := &route53.CreateHostedZoneInput{
|
||||
Name: aws.String(d.Get("name").(string)),
|
||||
HostedZoneConfig: comment,
|
||||
HostedZoneConfig: &route53.HostedZoneConfig{Comment: aws.String(d.Get("comment").(string))},
|
||||
CallerReference: aws.String(time.Now().Format(time.RFC3339Nano)),
|
||||
}
|
||||
if v := d.Get("vpc_id"); v != "" {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -54,6 +54,7 @@ resource "aws_route53_record" "dev-ns" {
|
|||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) This is the name of the hosted zone.
|
||||
* `comment` - (Optional) A comment for the hosted zone. Defaults to 'Managed by Terraform'.
|
||||
* `tags` - (Optional) A mapping of tags to assign to the zone.
|
||||
* `vpc_id` - (Optional) The VPC to associate with a private hosted zone. Specifying `vpc_id` will create a private hosted zone.
|
||||
* `vpc_region` - (Optional) The VPC's region. Defaults to the region of the AWS provider.
|
||||
|
|
Loading…
Reference in New Issue