VpcAssociationAuthorization class

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

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ec2.Vpc("example", {
    cidrBlock: "10.6.0.0/16",
    enableDnsHostnames: true,
    enableDnsSupport: true,
});
const exampleZone = new aws.route53.Zone("example", {
    vpcs: [{
        vpcId: example.id,
    }],
    name: "example.com",
}, {
    ignoreChanges: ["vpcs"],
});
const alternate = new aws.ec2.Vpc("alternate", {
    cidrBlock: "10.7.0.0/16",
    enableDnsHostnames: true,
    enableDnsSupport: true,
});
const exampleVpcAssociationAuthorization = new aws.route53.VpcAssociationAuthorization("example", {
    vpcId: alternate.id,
    zoneId: exampleZone.id,
});
const exampleZoneAssociation = new aws.route53.ZoneAssociation("example", {
    vpcId: exampleVpcAssociationAuthorization.vpcId,
    zoneId: exampleVpcAssociationAuthorization.zoneId,
});
import pulumi
import pulumi_aws as aws

example = aws.ec2.Vpc("example",
    cidr_block="10.6.0.0/16",
    enable_dns_hostnames=True,
    enable_dns_support=True)
example_zone = aws.route53.Zone("example",
    vpcs=[{
        "vpc_id": example.id,
    }],
    name="example.com",
    opts = pulumi.ResourceOptions(ignore_changes=["vpcs"]))
alternate = aws.ec2.Vpc("alternate",
    cidr_block="10.7.0.0/16",
    enable_dns_hostnames=True,
    enable_dns_support=True)
example_vpc_association_authorization = aws.route53.VpcAssociationAuthorization("example",
    vpc_id=alternate.id,
    zone_id=example_zone.id)
example_zone_association = aws.route53.ZoneAssociation("example",
    vpc_id=example_vpc_association_authorization.vpc_id,
    zone_id=example_vpc_association_authorization.zone_id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Ec2.Vpc("example", new()
    {
        CidrBlock = "10.6.0.0/16",
        EnableDnsHostnames = true,
        EnableDnsSupport = true,
    });

    var exampleZone = new Aws.Route53.Zone("example", new()
    {
        Vpcs = new[]
        {
            new Aws.Route53.Inputs.ZoneVpcArgs
            {
                VpcId = example.Id,
            },
        },
        Name = "example.com",
    }, new CustomResourceOptions
    {
        IgnoreChanges =
        {
            "vpcs",
        },
    });

    var alternate = new Aws.Ec2.Vpc("alternate", new()
    {
        CidrBlock = "10.7.0.0/16",
        EnableDnsHostnames = true,
        EnableDnsSupport = true,
    });

    var exampleVpcAssociationAuthorization = new Aws.Route53.VpcAssociationAuthorization("example", new()
    {
        VpcId = alternate.Id,
        ZoneId = exampleZone.Id,
    });

    var exampleZoneAssociation = new Aws.Route53.ZoneAssociation("example", new()
    {
        VpcId = exampleVpcAssociationAuthorization.VpcId,
        ZoneId = exampleVpcAssociationAuthorization.ZoneId,
    });

});
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 {
		example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
			CidrBlock:          pulumi.String("10.6.0.0/16"),
			EnableDnsHostnames: pulumi.Bool(true),
			EnableDnsSupport:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		exampleZone, err := route53.NewZone(ctx, "example", &route53.ZoneArgs{
			Vpcs: route53.ZoneVpcArray{
				&route53.ZoneVpcArgs{
					VpcId: example.ID().ToIDOutput().ToStringOutput(),
				},
			},
			Name: pulumi.String("example.com"),
		}, pulumi.IgnoreChanges([]string{
			"vpcs",
		}))
		if err != nil {
			return err
		}
		alternate, err := ec2.NewVpc(ctx, "alternate", &ec2.VpcArgs{
			CidrBlock:          pulumi.String("10.7.0.0/16"),
			EnableDnsHostnames: pulumi.Bool(true),
			EnableDnsSupport:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		exampleVpcAssociationAuthorization, err := route53.NewVpcAssociationAuthorization(ctx, "example", &route53.VpcAssociationAuthorizationArgs{
			VpcId:  alternate.ID().ToIDOutput().ToStringOutput(),
			ZoneId: exampleZone.ID().ToIDOutput().ToStringOutput(),
		})
		if err != nil {
			return err
		}
		_, err = route53.NewZoneAssociation(ctx, "example", &route53.ZoneAssociationArgs{
			VpcId:  exampleVpcAssociationAuthorization.VpcId,
			ZoneId: exampleVpcAssociationAuthorization.ZoneId,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_ec2_vpc" "example" {
  cidr_block           = "10.6.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.example.id
  }
  name = "example.com"
}
resource "aws_ec2_vpc" "alternate" {
  cidr_block           = "10.7.0.0/16"
  enable_dns_hostnames = true
  enable_dns_support   = true
}
resource "aws_route53_vpcassociationauthorization" "example" {
  vpc_id  = aws_ec2_vpc.alternate.id
  zone_id = aws_route53_zone.example.id
}
resource "aws_route53_zoneassociation" "example" {
  vpc_id  = aws_route53_vpcassociationauthorization.example.vpc_id
  zone_id = aws_route53_vpcassociationauthorization.example.zone_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.VpcAssociationAuthorization;
import com.pulumi.aws.route53.VpcAssociationAuthorizationArgs;
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 example = new Vpc("example", VpcArgs.builder()
            .cidrBlock("10.6.0.0/16")
            .enableDnsHostnames(true)
            .enableDnsSupport(true)
            .build());

        var exampleZone = new Zone("exampleZone", ZoneArgs.builder()
            .vpcs(ZoneVpcArgs.builder()
                .vpcId(example.id())
                .build())
            .name("example.com")
            .build(), CustomResourceOptions.builder()
                .ignoreChanges("vpcs")
                .build());

        var alternate = new Vpc("alternate", VpcArgs.builder()
            .cidrBlock("10.7.0.0/16")
            .enableDnsHostnames(true)
            .enableDnsSupport(true)
            .build());

        var exampleVpcAssociationAuthorization = new VpcAssociationAuthorization("exampleVpcAssociationAuthorization", VpcAssociationAuthorizationArgs.builder()
            .vpcId(alternate.id())
            .zoneId(exampleZone.id())
            .build());

        var exampleZoneAssociation = new ZoneAssociation("exampleZoneAssociation", ZoneAssociationArgs.builder()
            .vpcId(exampleVpcAssociationAuthorization.vpcId())
            .zoneId(exampleVpcAssociationAuthorization.zoneId())
            .build());

    }
}
resources:
  example:
    type: aws:ec2:Vpc
    properties:
      cidrBlock: 10.6.0.0/16
      enableDnsHostnames: true
      enableDnsSupport: true
  exampleZone:
    type: aws:route53:Zone
    name: example
    properties:
      vpcs:
        - vpcId: ${example.id}
      name: example.com
    options:
      ignoreChanges:
        - vpcs
  alternate:
    type: aws:ec2:Vpc
    properties:
      cidrBlock: 10.7.0.0/16
      enableDnsHostnames: true
      enableDnsSupport: true
  exampleVpcAssociationAuthorization:
    type: aws:route53:VpcAssociationAuthorization
    name: example
    properties:
      vpcId: ${alternate.id}
      zoneId: ${exampleZone.id}
  exampleZoneAssociation:
    type: aws:route53:ZoneAssociation
    name: example
    properties:
      vpcId: ${exampleVpcAssociationAuthorization.vpcId}
      zoneId: ${exampleVpcAssociationAuthorization.zoneId}

Import

Identity Schema

Required

  • zoneId (String) The ID of the private hosted zone that you want to authorize associating a VPC with.
  • vpcId (String) The VPC to authorize for association with the private hosted zone.

Optional

  • accountId (String) AWS Account where this resource is managed.

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

$ pulumi import aws:route53/vpcAssociationAuthorization:VpcAssociationAuthorization example Z123456ABCDEFG:vpc-12345678

Constructors

VpcAssociationAuthorization(String name, {VpcAssociationAuthorizationArgs? args, CustomResourceOptions? options})
Creates a new VpcAssociationAuthorization. name The Pulumi resource name. args Arguments used to configure this VpcAssociationAuthorization. The set of arguments for VpcAssociationAuthorization. options Resource options controlling this resource's behavior.
VpcAssociationAuthorization.reference(String urn)
Creates a typed reference to an existing VpcAssociationAuthorization 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
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 authorize for association 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 ID of the private hosted zone that you want to authorize associating a VPC with.
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, {VpcAssociationAuthorizationState? state, CustomResourceOptions? options}) → VpcAssociationAuthorization
Gets an existing VpcAssociationAuthorization resource's state with the given name and id.