Resource: aws_route53_vpc_association_authorization

Authorizes a VPC in a different account to be associated with a local Route53 Hosted Zone.

Example Usage

provider "aws" {
}

provider "aws" {
  alias = "alternate"
}

resource "aws_vpc" "example" {
  cidr_block           = "10.6.0.0/16"
  enable_dns_hostnames = true
  enable_dns_support   = true
}

resource "aws_route53_zone" "example" {
  name = "example.com"

  vpc {
    vpc_id = aws_vpc.example.id
  }

  # Prevent the deletion of associated VPCs after
  # the initial creation. See documentation on
  # aws_route53_zone_association for details
  lifecycle {
    ignore_changes = [vpc]
  }
}

resource "aws_vpc" "alternate" {
  provider = aws.alternate

  cidr_block           = "10.7.0.0/16"
  enable_dns_hostnames = true
  enable_dns_support   = true
}

resource "aws_route53_vpc_association_authorization" "example" {
  vpc_id  = aws_vpc.alternate.id
  zone_id = aws_route53_zone.example.id
}

resource "aws_route53_zone_association" "example" {
  provider = aws.alternate

  vpc_id  = aws_route53_vpc_association_authorization.example.vpc_id
  zone_id = aws_route53_vpc_association_authorization.example.zone_id
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import Route 53 VPC Association Authorizations using the Hosted Zone ID and VPC ID, separated by a colon (:). For example:

import {
  to = aws_route53_vpc_association_authorization.example
  id = "Z123456ABCDEFG:vpc-12345678"
}

Using terraform import, import Route 53 VPC Association Authorizations using the Hosted Zone ID and VPC ID, separated by a colon (:). For example:

% terraform import aws_route53_vpc_association_authorization.example Z123456ABCDEFG:vpc-12345678