Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.30.0 published on Tuesday, Nov 30, 2021 by Pulumi

ZoneAssociation

Manages a Route53 Hosted Zone VPC association. VPC associations can only be made on private zones. See the aws.route53.VpcAssociationAuthorization resource for setting up cross-account associations.

NOTE: Unless explicit association ordering is required (e.g. a separate cross-account association authorization), usage of this resource is not recommended. Use the vpc configuration blocks available within the aws.route53.Zone resource instead.

NOTE: This provider provides both this standalone Zone VPC Association resource and exclusive VPC associations defined in-line in the aws.route53.Zone resource via vpc configuration blocks. At this time, you cannot use those in-line VPC associations in conjunction with this resource and the same zone ID otherwise it will cause a perpetual difference in plan output. You can optionally use ignoreChanges in the aws.route53.Zone resource to manage additional associations via this resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var primary = new Aws.Ec2.Vpc("primary", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.6.0.0/16",
            EnableDnsHostnames = true,
            EnableDnsSupport = true,
        });
        var secondaryVpc = new Aws.Ec2.Vpc("secondaryVpc", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.7.0.0/16",
            EnableDnsHostnames = true,
            EnableDnsSupport = true,
        });
        var example = new Aws.Route53.Zone("example", new Aws.Route53.ZoneArgs
        {
            Vpcs = 
            {
                new Aws.Route53.Inputs.ZoneVpcArgs
                {
                    VpcId = primary.Id,
                },
            },
        });
        var secondaryZoneAssociation = new Aws.Route53.ZoneAssociation("secondaryZoneAssociation", new Aws.Route53.ZoneAssociationArgs
        {
            ZoneId = example.ZoneId,
            VpcId = secondaryVpc.Id,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/route53"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		primary, err := ec2.NewVpc(ctx, "primary", &ec2.VpcArgs{
			CidrBlock:          pulumi.String("10.6.0.0/16"),
			EnableDnsHostnames: pulumi.Bool(true),
			EnableDnsSupport:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		secondaryVpc, err := ec2.NewVpc(ctx, "secondaryVpc", &ec2.VpcArgs{
			CidrBlock:          pulumi.String("10.7.0.0/16"),
			EnableDnsHostnames: pulumi.Bool(true),
			EnableDnsSupport:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		example, err := route53.NewZone(ctx, "example", &route53.ZoneArgs{
			Vpcs: route53.ZoneVpcArray{
				&route53.ZoneVpcArgs{
					VpcId: primary.ID(),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = route53.NewZoneAssociation(ctx, "secondaryZoneAssociation", &route53.ZoneAssociationArgs{
			ZoneId: example.ZoneId,
			VpcId:  secondaryVpc.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

primary = aws.ec2.Vpc("primary",
    cidr_block="10.6.0.0/16",
    enable_dns_hostnames=True,
    enable_dns_support=True)
secondary_vpc = aws.ec2.Vpc("secondaryVpc",
    cidr_block="10.7.0.0/16",
    enable_dns_hostnames=True,
    enable_dns_support=True)
example = aws.route53.Zone("example", vpcs=[aws.route53.ZoneVpcArgs(
    vpc_id=primary.id,
)])
secondary_zone_association = aws.route53.ZoneAssociation("secondaryZoneAssociation",
    zone_id=example.zone_id,
    vpc_id=secondary_vpc.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const primary = new aws.ec2.Vpc("primary", {
    cidrBlock: "10.6.0.0/16",
    enableDnsHostnames: true,
    enableDnsSupport: true,
});
const secondaryVpc = new aws.ec2.Vpc("secondaryVpc", {
    cidrBlock: "10.7.0.0/16",
    enableDnsHostnames: true,
    enableDnsSupport: true,
});
const example = new aws.route53.Zone("example", {vpcs: [{
    vpcId: primary.id,
}]});
const secondaryZoneAssociation = new aws.route53.ZoneAssociation("secondaryZoneAssociation", {
    zoneId: example.zoneId,
    vpcId: secondaryVpc.id,
});

Create a ZoneAssociation Resource

new ZoneAssociation(name: string, args: ZoneAssociationArgs, opts?: CustomResourceOptions);
@overload
def ZoneAssociation(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    vpc_id: Optional[str] = None,
                    vpc_region: Optional[str] = None,
                    zone_id: Optional[str] = None)
@overload
def ZoneAssociation(resource_name: str,
                    args: ZoneAssociationArgs,
                    opts: Optional[ResourceOptions] = None)
func NewZoneAssociation(ctx *Context, name string, args ZoneAssociationArgs, opts ...ResourceOption) (*ZoneAssociation, error)
public ZoneAssociation(string name, ZoneAssociationArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ZoneAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ZoneAssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ZoneAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ZoneAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ZoneAssociation Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ZoneAssociation resource accepts the following input properties:

VpcId string
The VPC to associate with the private hosted zone.
ZoneId string
The private hosted zone to associate.
VpcRegion string
The VPC’s region. Defaults to the region of the AWS provider.
VpcId string
The VPC to associate with the private hosted zone.
ZoneId string
The private hosted zone to associate.
VpcRegion string
The VPC’s region. Defaults to the region of the AWS provider.
vpcId string
The VPC to associate with the private hosted zone.
zoneId string
The private hosted zone to associate.
vpcRegion string
The VPC’s region. Defaults to the region of the AWS provider.
vpc_id str
The VPC to associate with the private hosted zone.
zone_id str
The private hosted zone to associate.
vpc_region str
The VPC’s region. Defaults to the region of the AWS provider.

Outputs

All input properties are implicitly available as output properties. Additionally, the ZoneAssociation resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
OwningAccount string
The account ID of the account that created the hosted zone.
Id string
The provider-assigned unique ID for this managed resource.
OwningAccount string
The account ID of the account that created the hosted zone.
id string
The provider-assigned unique ID for this managed resource.
owningAccount string
The account ID of the account that created the hosted zone.
id str
The provider-assigned unique ID for this managed resource.
owning_account str
The account ID of the account that created the hosted zone.

Look up an Existing ZoneAssociation Resource

Get an existing ZoneAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ZoneAssociationState, opts?: CustomResourceOptions): ZoneAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        owning_account: Optional[str] = None,
        vpc_id: Optional[str] = None,
        vpc_region: Optional[str] = None,
        zone_id: Optional[str] = None) -> ZoneAssociation
func GetZoneAssociation(ctx *Context, name string, id IDInput, state *ZoneAssociationState, opts ...ResourceOption) (*ZoneAssociation, error)
public static ZoneAssociation Get(string name, Input<string> id, ZoneAssociationState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

OwningAccount string
The account ID of the account that created the hosted zone.
VpcId string
The VPC to associate with the private hosted zone.
VpcRegion string
The VPC’s region. Defaults to the region of the AWS provider.
ZoneId string
The private hosted zone to associate.
OwningAccount string
The account ID of the account that created the hosted zone.
VpcId string
The VPC to associate with the private hosted zone.
VpcRegion string
The VPC’s region. Defaults to the region of the AWS provider.
ZoneId string
The private hosted zone to associate.
owningAccount string
The account ID of the account that created the hosted zone.
vpcId string
The VPC to associate with the private hosted zone.
vpcRegion string
The VPC’s region. Defaults to the region of the AWS provider.
zoneId string
The private hosted zone to associate.
owning_account str
The account ID of the account that created the hosted zone.
vpc_id str
The VPC to associate with the private hosted zone.
vpc_region str
The VPC’s region. Defaults to the region of the AWS provider.
zone_id str
The private hosted zone to associate.

Import

Route 53 Hosted Zone Associations can be imported via the Hosted Zone ID and VPC ID, separated by a colon (:), e.g.,

 $ pulumi import aws:route53/zoneAssociation:ZoneAssociation example Z123456ABCDEFG:vpc-12345678

If the VPC is in a different region than the provider region configuration, the VPC Region can be added to the end. e.g.

 $ pulumi import aws:route53/zoneAssociation:ZoneAssociation example Z123456ABCDEFG:vpc-12345678:us-east-2

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.