ZoneAssociation class
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
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 secondary = new aws.ec2.Vpc("secondary", {
cidrBlock: "10.7.0.0/16",
enableDnsHostnames: true,
enableDnsSupport: true,
});
const example = new aws.route53.Zone("example", {
vpcs: [{
vpcId: primary.id,
}],
name: "example.com",
}, {
ignoreChanges: ["vpcs"],
});
const secondaryZoneAssociation = new aws.route53.ZoneAssociation("secondary", {
zoneId: example.zoneId,
vpcId: secondary.id,
});
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 = aws.ec2.Vpc("secondary",
cidr_block="10.7.0.0/16",
enable_dns_hostnames=True,
enable_dns_support=True)
example = aws.route53.Zone("example",
vpcs=[{
"vpc_id": primary.id,
}],
name="example.com",
opts = pulumi.ResourceOptions(ignore_changes=["vpcs"]))
secondary_zone_association = aws.route53.ZoneAssociation("secondary",
zone_id=example.zone_id,
vpc_id=secondary.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var primary = new Aws.Ec2.Vpc("primary", new()
{
CidrBlock = "10.6.0.0/16",
EnableDnsHostnames = true,
EnableDnsSupport = true,
});
var secondary = new Aws.Ec2.Vpc("secondary", new()
{
CidrBlock = "10.7.0.0/16",
EnableDnsHostnames = true,
EnableDnsSupport = true,
});
var example = new Aws.Route53.Zone("example", new()
{
Vpcs = new[]
{
new Aws.Route53.Inputs.ZoneVpcArgs
{
VpcId = primary.Id,
},
},
Name = "example.com",
}, new CustomResourceOptions
{
IgnoreChanges =
{
"vpcs",
},
});
var secondaryZoneAssociation = new Aws.Route53.ZoneAssociation("secondary", new()
{
ZoneId = example.ZoneId,
VpcId = secondary.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v7/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
}
secondary, err := ec2.NewVpc(ctx, "secondary", &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().ToIDOutput().ToStringOutput(),
},
},
Name: pulumi.String("example.com"),
}, pulumi.IgnoreChanges([]string{
"vpcs",
}))
if err != nil {
return err
}
_, err = route53.NewZoneAssociation(ctx, "secondary", &route53.ZoneAssociationArgs{
ZoneId: example.ZoneId,
VpcId: secondary.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_vpc" "primary" {
cidr_block = "10.6.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
}
resource "aws_ec2_vpc" "secondary" {
cidr_block = "10.7.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
}
resource "aws_route53_zone" "example" {
lifecycle {
ignore_changes = [vpcs]
}
vpcs {
vpc_id = aws_ec2_vpc.primary.id
}
name = "example.com"
}
resource "aws_route53_zoneassociation" "secondary" {
zone_id = aws_route53_zone.example.zone_id
vpc_id = aws_ec2_vpc.secondary.id
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.route53.Zone;
import com.pulumi.aws.route53.ZoneArgs;
import com.pulumi.aws.route53.inputs.ZoneVpcArgs;
import com.pulumi.aws.route53.ZoneAssociation;
import com.pulumi.aws.route53.ZoneAssociationArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Vpc("primary", VpcArgs.builder()
.cidrBlock("10.6.0.0/16")
.enableDnsHostnames(true)
.enableDnsSupport(true)
.build());
var secondary = new Vpc("secondary", VpcArgs.builder()
.cidrBlock("10.7.0.0/16")
.enableDnsHostnames(true)
.enableDnsSupport(true)
.build());
var example = new Zone("example", ZoneArgs.builder()
.vpcs(ZoneVpcArgs.builder()
.vpcId(primary.id())
.build())
.name("example.com")
.build(), CustomResourceOptions.builder()
.ignoreChanges("vpcs")
.build());
var secondaryZoneAssociation = new ZoneAssociation("secondaryZoneAssociation", ZoneAssociationArgs.builder()
.zoneId(example.zoneId())
.vpcId(secondary.id())
.build());
}
}
resources:
primary:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.6.0.0/16
enableDnsHostnames: true
enableDnsSupport: true
secondary:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.7.0.0/16
enableDnsHostnames: true
enableDnsSupport: true
example:
type: aws:route53:Zone
properties:
vpcs:
- vpcId: ${primary.id}
name: example.com
options:
ignoreChanges:
- vpcs
secondaryZoneAssociation:
type: aws:route53:ZoneAssociation
name: secondary
properties:
zoneId: ${example.zoneId}
vpcId: ${secondary.id}
Import
Identity Schema
Required
zoneId(String) The ID of the private hosted zone that you want to associate a VPC with.vpcId(String) The VPC to associate with the private hosted zone.
Optional
vpcRegion(String) The VPC's region. Defaults to the region of the AWS provider.accountId(String) AWS Account where this resource is managed.
The VPC is not in the same region where you have configured the AWS Provider:
Using pulumi import to import Route 53 Hosted Zone Associations using the Hosted Zone ID and VPC ID, separated by a colon (:). For example:
The VPC is in the same region where you have configured the AWS Provider:
$ pulumi import aws:route53/zoneAssociation:ZoneAssociation example Z123456ABCDEFG:vpc-12345678
The VPC is not in the same region where you have configured the AWS Provider:
$ pulumi import aws:route53/zoneAssociation:ZoneAssociation example Z123456ABCDEFG:vpc-12345678:us-east-2
Constructors
- ZoneAssociation(String name, {ZoneAssociationArgs? args, CustomResourceOptions? options})
-
Creates a new ZoneAssociation.
nameThe Pulumi resource name.argsArguments used to configure this ZoneAssociation. The set of arguments for ZoneAssociation.optionsResource options controlling this resource's behavior. - ZoneAssociation.reference(String urn)
- Creates a typed reference to an existing ZoneAssociation resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
owningAccount
↔ Output<
String> -
The account ID of the account that created the hosted zone.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
vpcId
↔ Output<
String> -
The VPC to associate with the private hosted zone.
latefinal
-
vpcRegion
↔ Output<
String> -
The VPC's region. Defaults to the region of the AWS provider.
latefinal
-
zoneId
↔ Output<
String> -
The private hosted zone to associate.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {ZoneAssociationState? state, CustomResourceOptions? options}) → ZoneAssociation -
Gets an existing ZoneAssociation resource's state with the given
nameandid.