Zone
Manages a Route53 Hosted Zone.
Example Usage
Public Zone
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var primary = new Aws.Route53.Zone("primary", new Aws.Route53.ZoneArgs
{
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := route53.NewZone(ctx, "primary", nil)
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
primary = aws.route53.Zone("primary")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const primary = new aws.route53.Zone("primary", {});Public Subdomain Zone
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var main = new Aws.Route53.Zone("main", new Aws.Route53.ZoneArgs
{
});
var dev = new Aws.Route53.Zone("dev", new Aws.Route53.ZoneArgs
{
Tags =
{
{ "Environment", "dev" },
},
});
var dev_ns = new Aws.Route53.Record("dev-ns", new Aws.Route53.RecordArgs
{
Name = "dev.example.com",
Records =
{
dev.NameServers.Apply(nameServers => nameServers[0]),
dev.NameServers.Apply(nameServers => nameServers[1]),
dev.NameServers.Apply(nameServers => nameServers[2]),
dev.NameServers.Apply(nameServers => nameServers[3]),
},
Ttl = 30,
Type = "NS",
ZoneId = main.ZoneId,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := route53.NewZone(ctx, "main", nil)
if err != nil {
return err
}
dev, err := route53.NewZone(ctx, "dev", &route53.ZoneArgs{
Tags: pulumi.StringMap{
"Environment": pulumi.String("dev"),
},
})
if err != nil {
return err
}
_, err = route53.NewRecord(ctx, "dev_ns", &route53.RecordArgs{
Name: pulumi.String("dev.example.com"),
Records: pulumi.StringArray{
dev.NameServers.ApplyT(func(nameServers []string) (string, error) {
return nameServers[0], nil
}).(pulumi.StringOutput),
dev.NameServers.ApplyT(func(nameServers []string) (string, error) {
return nameServers[1], nil
}).(pulumi.StringOutput),
dev.NameServers.ApplyT(func(nameServers []string) (string, error) {
return nameServers[2], nil
}).(pulumi.StringOutput),
dev.NameServers.ApplyT(func(nameServers []string) (string, error) {
return nameServers[3], nil
}).(pulumi.StringOutput),
},
Ttl: pulumi.Int(30),
Type: pulumi.String("NS"),
ZoneId: main.ZoneId,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
main = aws.route53.Zone("main")
dev = aws.route53.Zone("dev", tags={
"Environment": "dev",
})
dev_ns = aws.route53.Record("dev-ns",
name="dev.example.com",
records=[
dev.name_servers[0],
dev.name_servers[1],
dev.name_servers[2],
dev.name_servers[3],
],
ttl="30",
type="NS",
zone_id=main.zone_id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const main = new aws.route53.Zone("main", {});
const dev = new aws.route53.Zone("dev", {
tags: {
Environment: "dev",
},
});
const dev_ns = new aws.route53.Record("dev-ns", {
name: "dev.example.com",
records: [
dev.nameServers[0],
dev.nameServers[1],
dev.nameServers[2],
dev.nameServers[3],
],
ttl: 30,
type: "NS",
zoneId: main.zoneId,
});Private Zone
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var @private = new Aws.Route53.Zone("private", new Aws.Route53.ZoneArgs
{
Vpcs =
{
new Aws.Route53.Inputs.ZoneVpcArgs
{
VpcId = aws_vpc.Example.Id,
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := route53.NewZone(ctx, "private", &route53.ZoneArgs{
Vpcs: route53.ZoneVpcArray{
&route53.ZoneVpcArgs{
VpcId: pulumi.String(aws_vpc.Example.Id),
},
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
private = aws.route53.Zone("private", vpcs=[{
"vpc_id": aws_vpc["example"]["id"],
}])import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const privateZone = new aws.route53.Zone("private", {
vpcs: [{
vpcId: aws_vpc_example.id,
}],
});Create a Zone Resource
new Zone(name: string, args?: ZoneArgs, opts?: CustomResourceOptions);def Zone(resource_name, opts=None, comment=None, delegation_set_id=None, force_destroy=None, name=None, tags=None, vpcs=None, __props__=None);public Zone(string name, ZoneArgs? args = null, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ZoneArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Zone Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Zone resource accepts the following input properties:
- Comment string
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- Delegation
Set stringId The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- Force
Destroy bool Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- Name string
This is the name of the hosted zone.
- Dictionary<string, string>
A mapping of tags to assign to the zone.
- Vpcs
List<Zone
Vpc Args> Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.
- Comment string
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- Delegation
Set stringId The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- Force
Destroy bool Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- Name string
This is the name of the hosted zone.
- map[string]string
A mapping of tags to assign to the zone.
- Vpcs
[]Zone
Vpc Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.
- comment string
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- delegation
Set stringId The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- force
Destroy boolean Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- name string
This is the name of the hosted zone.
- {[key: string]: string}
A mapping of tags to assign to the zone.
- vpcs
Zone
Vpc[] Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.
- comment str
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- delegation_
set_ strid The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- force_
destroy bool Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- name str
This is the name of the hosted zone.
- Dict[str, str]
A mapping of tags to assign to the zone.
- vpcs
List[Zone
Vpc] Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.
Outputs
All input properties are implicitly available as output properties. Additionally, the Zone resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Name
Servers List<string> A list of name servers in associated (or default) delegation set. Find more about delegation sets in AWS docs.
- Zone
Id string The Hosted Zone ID. This can be referenced by zone records.
Look up an Existing Zone Resource
Get an existing Zone 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?: ZoneState, opts?: CustomResourceOptions): Zonestatic get(resource_name, id, opts=None, comment=None, delegation_set_id=None, force_destroy=None, name=None, name_servers=None, tags=None, vpcs=None, zone_id=None, __props__=None);public static Zone Get(string name, Input<string> id, ZoneState? 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:
- Comment string
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- Delegation
Set stringId The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- Force
Destroy bool Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- Name string
This is the name of the hosted zone.
- Name
Servers List<string> A list of name servers in associated (or default) delegation set. Find more about delegation sets in AWS docs.
- Dictionary<string, string>
A mapping of tags to assign to the zone.
- Vpcs
List<Zone
Vpc Args> Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.- Zone
Id string The Hosted Zone ID. This can be referenced by zone records.
- Comment string
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- Delegation
Set stringId The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- Force
Destroy bool Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- Name string
This is the name of the hosted zone.
- Name
Servers []string A list of name servers in associated (or default) delegation set. Find more about delegation sets in AWS docs.
- map[string]string
A mapping of tags to assign to the zone.
- Vpcs
[]Zone
Vpc Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.- Zone
Id string The Hosted Zone ID. This can be referenced by zone records.
- comment string
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- delegation
Set stringId The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- force
Destroy boolean Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- name string
This is the name of the hosted zone.
- name
Servers string[] A list of name servers in associated (or default) delegation set. Find more about delegation sets in AWS docs.
- {[key: string]: string}
A mapping of tags to assign to the zone.
- vpcs
Zone
Vpc[] Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.- zone
Id string The Hosted Zone ID. This can be referenced by zone records.
- comment str
A comment for the hosted zone. Defaults to ‘Managed by Pulumi’.
- delegation_
set_ strid The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with
vpcas delegation sets can only be used for public zones.- force_
destroy bool Whether to destroy all records (possibly managed outside of this provider) in the zone when destroying the zone.
- name str
This is the name of the hosted zone.
- name_
servers List[str] A list of name servers in associated (or default) delegation set. Find more about delegation sets in AWS docs.
- Dict[str, str]
A mapping of tags to assign to the zone.
- vpcs
List[Zone
Vpc] Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the
delegation_set_idargument in this resource and anyaws.route53.ZoneAssociationresource specifying the same zone ID. Detailed below.- zone_
id str The Hosted Zone ID. This can be referenced by zone records.
Supporting Types
ZoneVpc
- vpc_
id str ID of the VPC to associate.
- vpc_
region str Region of the VPC to associate. Defaults to AWS provider region.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.