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

getZone

aws.route53.Zone provides details about a specific Route 53 Hosted Zone.

This data source allows to find a Hosted Zone ID given Hosted Zone name and certain search criteria.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var selected = Output.Create(Aws.Route53.GetZone.InvokeAsync(new Aws.Route53.GetZoneArgs
        {
            Name = "test.com.",
            PrivateZone = true,
        }));
        var www = new Aws.Route53.Record("www", new Aws.Route53.RecordArgs
        {
            ZoneId = selected.Apply(selected => selected.ZoneId),
            Name = selected.Apply(selected => $"www.{selected.Name}"),
            Type = "A",
            Ttl = 300,
            Records = 
            {
                "10.0.0.1",
            },
        });
    }

}
package main

import (
	"fmt"

	"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 {
		opt0 := "test.com."
		opt1 := true
		selected, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{
			Name:        &opt0,
			PrivateZone: &opt1,
		}, nil)
		if err != nil {
			return err
		}
		_, err = route53.NewRecord(ctx, "www", &route53.RecordArgs{
			ZoneId: pulumi.String(selected.ZoneId),
			Name:   pulumi.String(fmt.Sprintf("%v%v", "www.", selected.Name)),
			Type:   pulumi.String("A"),
			Ttl:    pulumi.Int(300),
			Records: pulumi.StringArray{
				pulumi.String("10.0.0.1"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

selected = aws.route53.get_zone(name="test.com.",
    private_zone=True)
www = aws.route53.Record("www",
    zone_id=selected.zone_id,
    name=f"www.{selected.name}",
    type="A",
    ttl=300,
    records=["10.0.0.1"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const selected = aws.route53.getZone({
    name: "test.com.",
    privateZone: true,
});
const www = new aws.route53.Record("www", {
    zoneId: selected.then(selected => selected.zoneId),
    name: selected.then(selected => `www.${selected.name}`),
    type: "A",
    ttl: "300",
    records: ["10.0.0.1"],
});

Using getZone

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getZone(args: GetZoneArgs, opts?: InvokeOptions): Promise<GetZoneResult>
function getZoneOutput(args: GetZoneOutputArgs, opts?: InvokeOptions): Output<GetZoneResult>
def get_zone(name: Optional[str] = None,
             private_zone: Optional[bool] = None,
             resource_record_set_count: Optional[int] = None,
             tags: Optional[Mapping[str, str]] = None,
             vpc_id: Optional[str] = None,
             zone_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetZoneResult
def get_zone_output(name: Optional[pulumi.Input[str]] = None,
             private_zone: Optional[pulumi.Input[bool]] = None,
             resource_record_set_count: Optional[pulumi.Input[int]] = None,
             tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
             vpc_id: Optional[pulumi.Input[str]] = None,
             zone_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetZoneResult]
func LookupZone(ctx *Context, args *LookupZoneArgs, opts ...InvokeOption) (*LookupZoneResult, error)
func LookupZoneOutput(ctx *Context, args *LookupZoneOutputArgs, opts ...InvokeOption) LookupZoneResultOutput

> Note: This function is named LookupZone in the Go SDK.

public static class GetZone 
{
    public static Task<GetZoneResult> InvokeAsync(GetZoneArgs args, InvokeOptions? opts = null)
    public static Output<GetZoneResult> Invoke(GetZoneInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string
The Hosted Zone name of the desired Hosted Zone.
PrivateZone bool
Used with name field to get a private Hosted Zone.
ResourceRecordSetCount int
The number of Record Set in the Hosted Zone.
Tags Dictionary<string, string>
Used with name field. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.
VpcId string
Used with name field to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).
ZoneId string
The Hosted Zone id of the desired Hosted Zone.
Name string
The Hosted Zone name of the desired Hosted Zone.
PrivateZone bool
Used with name field to get a private Hosted Zone.
ResourceRecordSetCount int
The number of Record Set in the Hosted Zone.
Tags map[string]string
Used with name field. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.
VpcId string
Used with name field to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).
ZoneId string
The Hosted Zone id of the desired Hosted Zone.
name string
The Hosted Zone name of the desired Hosted Zone.
privateZone boolean
Used with name field to get a private Hosted Zone.
resourceRecordSetCount number
The number of Record Set in the Hosted Zone.
tags {[key: string]: string}
Used with name field. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.
vpcId string
Used with name field to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).
zoneId string
The Hosted Zone id of the desired Hosted Zone.
name str
The Hosted Zone name of the desired Hosted Zone.
private_zone bool
Used with name field to get a private Hosted Zone.
resource_record_set_count int
The number of Record Set in the Hosted Zone.
tags Mapping[str, str]
Used with name field. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.
vpc_id str
Used with name field to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).
zone_id str
The Hosted Zone id of the desired Hosted Zone.

getZone Result

The following output properties are available:

Arn string
The Amazon Resource Name (ARN) of the Hosted Zone.
CallerReference string
Caller Reference of the Hosted Zone.
Comment string
The comment field of the Hosted Zone.
Id string
The provider-assigned unique ID for this managed resource.
LinkedServiceDescription string
The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
LinkedServicePrincipal string
The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
Name string
NameServers List<string>
The list of DNS name servers for the Hosted Zone.
ResourceRecordSetCount int
The number of Record Set in the Hosted Zone.
Tags Dictionary<string, string>
VpcId string
ZoneId string
PrivateZone bool
Arn string
The Amazon Resource Name (ARN) of the Hosted Zone.
CallerReference string
Caller Reference of the Hosted Zone.
Comment string
The comment field of the Hosted Zone.
Id string
The provider-assigned unique ID for this managed resource.
LinkedServiceDescription string
The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
LinkedServicePrincipal string
The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
Name string
NameServers []string
The list of DNS name servers for the Hosted Zone.
ResourceRecordSetCount int
The number of Record Set in the Hosted Zone.
Tags map[string]string
VpcId string
ZoneId string
PrivateZone bool
arn string
The Amazon Resource Name (ARN) of the Hosted Zone.
callerReference string
Caller Reference of the Hosted Zone.
comment string
The comment field of the Hosted Zone.
id string
The provider-assigned unique ID for this managed resource.
linkedServiceDescription string
The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
linkedServicePrincipal string
The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
name string
nameServers string[]
The list of DNS name servers for the Hosted Zone.
resourceRecordSetCount number
The number of Record Set in the Hosted Zone.
tags {[key: string]: string}
vpcId string
zoneId string
privateZone boolean
arn str
The Amazon Resource Name (ARN) of the Hosted Zone.
caller_reference str
Caller Reference of the Hosted Zone.
comment str
The comment field of the Hosted Zone.
id str
The provider-assigned unique ID for this managed resource.
linked_service_description str
The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
linked_service_principal str
The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
name str
name_servers Sequence[str]
The list of DNS name servers for the Hosted Zone.
resource_record_set_count int
The number of Record Set in the Hosted Zone.
tags Mapping[str, str]
vpc_id str
zone_id str
private_zone bool

Package Details

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