diff --git a/CHANGELOG.md b/CHANGELOG.md index 78ba3ce660..282716e33c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ IMPROVEMENTS: * **New config function: `formatlist`** - Format lists in a similar way to `format`. Useful for creating URLs from a list of IPs. [GH-1829] + * **New resource: `aws_route53_zone_association`** * provider/aws: `aws_autoscaling_group` can wait for capacity in ELB via `min_elb_capacity` [GH-1970] * provider/aws: `aws_db_instances` supports `license_model` [GH-1966] diff --git a/builtin/providers/aws/resource_aws_route53_zone.go b/builtin/providers/aws/resource_aws_route53_zone.go index fd74ed1670..7711a187d2 100644 --- a/builtin/providers/aws/resource_aws_route53_zone.go +++ b/builtin/providers/aws/resource_aws_route53_zone.go @@ -121,7 +121,7 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error return err } - if ! *zone.HostedZone.Config.PrivateZone { + if !*zone.HostedZone.Config.PrivateZone { ns := make([]string, len(zone.DelegationSet.NameServers)) for i := range zone.DelegationSet.NameServers { ns[i] = *zone.DelegationSet.NameServers[i] @@ -131,10 +131,10 @@ func resourceAwsRoute53ZoneRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("[DEBUG] Error setting name servers for: %s, error: %#v", d.Id(), err) } } else { - d.Set("name_servers", nil); + d.Set("name_servers", nil) var associatedVPC *route53.VPC for _, vpc := range zone.VPCs { - if (*vpc.VPCID == d.Get("vpc_id")) { + if *vpc.VPCID == d.Get("vpc_id") { associatedVPC = vpc } } diff --git a/builtin/providers/aws/resource_aws_route53_zone_association.go b/builtin/providers/aws/resource_aws_route53_zone_association.go index 6d53d937f6..d2fc2a2c4b 100644 --- a/builtin/providers/aws/resource_aws_route53_zone_association.go +++ b/builtin/providers/aws/resource_aws_route53_zone_association.go @@ -36,7 +36,6 @@ func resourceAwsRoute53ZoneAssociation() *schema.Resource { Optional: true, Computed: true, }, - }, } } diff --git a/builtin/providers/aws/resource_aws_route53_zone_association_test.go b/builtin/providers/aws/resource_aws_route53_zone_association_test.go index d8389e35df..d3031739d5 100644 --- a/builtin/providers/aws/resource_aws_route53_zone_association_test.go +++ b/builtin/providers/aws/resource_aws_route53_zone_association_test.go @@ -45,9 +45,9 @@ func TestAccRoute53ZoneAssociationWithRegion(t *testing.T) { } resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, - CheckDestroy: testAccCheckRoute53ZoneAssociationDestroyWithProviders(&providers), + CheckDestroy: testAccCheckRoute53ZoneAssociationDestroyWithProviders(&providers), Steps: []resource.TestStep{ resource.TestStep{ Config: testAccRoute53ZoneAssociationRegionConfig, diff --git a/builtin/providers/aws/resource_aws_route53_zone_test.go b/builtin/providers/aws/resource_aws_route53_zone_test.go index 1ca3927ecb..3a2d1279f9 100644 --- a/builtin/providers/aws/resource_aws_route53_zone_test.go +++ b/builtin/providers/aws/resource_aws_route53_zone_test.go @@ -119,9 +119,9 @@ func TestAccRoute53PrivateZoneWithRegion(t *testing.T) { } resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, - CheckDestroy: testAccCheckRoute53ZoneDestroyWithProviders(&providers), + CheckDestroy: testAccCheckRoute53ZoneDestroyWithProviders(&providers), Steps: []resource.TestStep{ resource.TestStep{ Config: testAccRoute53PrivateZoneRegionConfig, @@ -203,7 +203,7 @@ func testAccCheckRoute53ZoneExistsWithProvider(s *terraform.State, n string, zon return fmt.Errorf("Hosted zone err: %v", err) } - if ! *resp.HostedZone.Config.PrivateZone { + if !*resp.HostedZone.Config.PrivateZone { sorted_ns := make([]string, len(resp.DelegationSet.NameServers)) for i, ns := range resp.DelegationSet.NameServers { sorted_ns[i] = *ns diff --git a/website/source/docs/providers/aws/r/route53_zone_association.html.markdown b/website/source/docs/providers/aws/r/route53_zone_association.html.markdown new file mode 100644 index 0000000000..49995fb63d --- /dev/null +++ b/website/source/docs/providers/aws/r/route53_zone_association.html.markdown @@ -0,0 +1,54 @@ +--- +layout: "aws" +page_title: "AWS: aws_route53_zone_association" +sidebar_current: "docs-aws-resource-route53-zone-association" +description: |- + Provides a Route53 private Hosted Zone to VPC association resource. +--- + +# aws\_route53\_zone\_association + +Provides a Route53 private Hosted Zone to VPC association resource. + +## Example Usage + +``` +resource "aws_vpc" "primary" { + cidr_block = "10.6.0.0/16" + enable_dns_hostnames = true + enable_dns_support = true +} + +resource "aws_vpc" "secondary" { + cidr_block = "10.7.0.0/16" + enable_dns_hostnames = true + enable_dns_support = true +} + +resource "aws_route53_zone" "example" { + name = "example.com" + vpc_id = "${aws_vpc.primary.id}" +} + +resource "aws_route53_zone_assocation" "secondary" { + zone_id = "${aws_route53_zone.example.id}" + vpc_id = "${aws_vpc.secondary.id}" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `zone_id` - (Required) The private hosted zone to associate. +* `vpc_id` - (Required) The VPC to associate with the private hosted zone. +* `vpc_region` - (Optional) The VPC's region. Defaults to the region of the AWS provider. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The calculated unique identifier for the association. +* `zone_id` - The ID of the hosted zone for the association. +* `vpc_id` - The ID of the VPC for the association. +* `vpc_region` - The region in which the VPC identified by `vpc_id` was created.