Merge pull request #1415 from hashicorp/b-fix-route53-recorcd-zone
provider/aws: Fix issue with Route 53 and pre-existing, external Hosted zones
This commit is contained in:
commit
9a3bc12cff
|
@ -60,7 +60,7 @@ func resourceAwsRoute53Record() *schema.Resource {
|
||||||
|
|
||||||
func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
conn := meta.(*AWSClient).r53conn
|
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)})
|
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -151,7 +151,7 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
|
||||||
func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsRoute53RecordRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
conn := meta.(*AWSClient).r53conn
|
conn := meta.(*AWSClient).r53conn
|
||||||
|
|
||||||
zone := d.Get("zone_id").(string)
|
zone := cleanZoneID(d.Get("zone_id").(string))
|
||||||
|
|
||||||
// get expanded name
|
// get expanded name
|
||||||
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)})
|
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 {
|
func resourceAwsRoute53RecordDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
conn := meta.(*AWSClient).r53conn
|
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",
|
log.Printf("[DEBUG] Deleting resource records for zone: %s, name: %s",
|
||||||
zone, d.Get("name").(string))
|
zone, d.Get("name").(string))
|
||||||
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)})
|
zoneRecord, err := conn.GetHostedZone(&route53.GetHostedZoneRequest{ID: aws.String(zone)})
|
||||||
|
|
|
@ -275,7 +275,7 @@ resource "aws_route53_zone" "main" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_route53_record" "default" {
|
resource "aws_route53_record" "default" {
|
||||||
zone_id = "${aws_route53_zone.main.zone_id}"
|
zone_id = "/hostedzone/${aws_route53_zone.main.zone_id}"
|
||||||
name = "subdomain"
|
name = "subdomain"
|
||||||
type = "TXT"
|
type = "TXT"
|
||||||
ttl = "30"
|
ttl = "30"
|
||||||
|
|
Loading…
Reference in New Issue