From 547080002c74a81bde7ed0ce8b14ac2478758c16 Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Tue, 7 Apr 2015 15:20:56 -0500 Subject: [PATCH] provider/aws: Fix issue with Route 53 and pre-existing, external Hosted Zones --- builtin/providers/aws/resource_aws_route53_record.go | 6 +++--- builtin/providers/aws/resource_aws_route53_record_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_route53_record.go b/builtin/providers/aws/resource_aws_route53_record.go index 71ddff056..bbf3d6fef 100644 --- a/builtin/providers/aws/resource_aws_route53_record.go +++ b/builtin/providers/aws/resource_aws_route53_record.go @@ -60,7 +60,7 @@ func resourceAwsRoute53Record() *schema.Resource { func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).r53conn - zone := d.Get("zone_id").(string) + zone := cleanZoneID(d.Get("zone_id").(string)) zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)}) if err != nil { @@ -151,7 +151,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).r53conn - zone := d.Get("zone_id").(string) + zone := cleanZoneID(d.Get("zone_id").(string)) // get expanded name zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)}) @@ -200,7 +200,7 @@ func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) erro func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).r53conn - zone := d.Get("zone_id").(string) + zone := cleanZoneID(d.Get("zone_id").(string)) log.Printf("[DEBUG] Deleting resource records for zone: %s, name: %s", zone, d.Get("name").(string)) zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)}) diff --git a/builtin/providers/aws/resource_aws_route53_record_test.go b/builtin/providers/aws/resource_aws_route53_record_test.go index 8aa0a1e56..16eda8139 100644 --- a/builtin/providers/aws/resource_aws_route53_record_test.go +++ b/builtin/providers/aws/resource_aws_route53_record_test.go @@ -275,7 +275,7 @@ resource "aws_route53_zone" "main" { } resource "aws_route53_record" "default" { - zone_id = "${aws_route53_zone.main.zone_id}" + zone_id = "/hostedzone/${aws_route53_zone.main.zone_id}" name = "subdomain" type = "TXT" ttl = "30"