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
{
Name = selected.Apply(selected => $"www.{selected.Name}"),
Records =
{
"10.0.0.1",
},
Ttl = 300,
Type = "A",
ZoneId = selected.Apply(selected => selected.ZoneId),
});
}
}
package main
import (
"fmt"
"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 {
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{
Name: pulumi.String(fmt.Sprintf("%v%v", "www.", selected.Name)),
Records: pulumi.StringArray{
pulumi.String("10.0.0.1"),
},
Ttl: pulumi.Int(300),
Type: pulumi.String("A"),
ZoneId: pulumi.String(selected.ZoneId),
})
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",
name=f"www.{selected.name}",
records=["10.0.0.1"],
ttl="300",
type="A",
zone_id=selected.zone_id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const selected = pulumi.output(aws.route53.getZone({
name: "test.com.",
privateZone: true,
}, { async: true }));
const www = new aws.route53.Record("www", {
name: pulumi.interpolate`www.${selected.name!}`,
records: ["10.0.0.1"],
ttl: 300,
type: "A",
zoneId: selected.zoneId!,
});Using GetZone
function getZone(args: GetZoneArgs, opts?: InvokeOptions): Promise<GetZoneResult>function get_zone(name=None, private_zone=None, resource_record_set_count=None, tags=None, vpc_id=None, zone_id=None, opts=None)func LookupZone(ctx *Context, args *LookupZoneArgs, opts ...InvokeOption) (*LookupZoneResult, error)Note: This function is named
LookupZonein the Go SDK.
public static class GetZone {
public static Task<GetZoneResult> InvokeAsync(GetZoneArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Name string
The Hosted Zone name of the desired Hosted Zone.
- Private
Zone bool Used with
namefield to get a private Hosted Zone.- Resource
Record intSet Count The number of Record Set in the Hosted Zone.
- Dictionary<string, string>
Used with
namefield. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.- Vpc
Id string Used with
namefield to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).- Zone
Id string The Hosted Zone id of the desired Hosted Zone.
- Name string
The Hosted Zone name of the desired Hosted Zone.
- Private
Zone bool Used with
namefield to get a private Hosted Zone.- Resource
Record intSet Count The number of Record Set in the Hosted Zone.
- map[string]string
Used with
namefield. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.- Vpc
Id string Used with
namefield to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).- Zone
Id string The Hosted Zone id of the desired Hosted Zone.
- name string
The Hosted Zone name of the desired Hosted Zone.
- private
Zone boolean Used with
namefield to get a private Hosted Zone.- resource
Record numberSet Count The number of Record Set in the Hosted Zone.
- {[key: string]: string}
Used with
namefield. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.- vpc
Id string Used with
namefield to get a private Hosted Zone associated with the vpc_id (in this case, private_zone is not mandatory).- zone
Id 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
namefield to get a private Hosted Zone.- resource_
record_ floatset_ count The number of Record Set in the Hosted Zone.
- Dict[str, str]
Used with
namefield. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.- vpc_
id str Used with
namefield 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:
- Caller
Reference 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.
- Linked
Service stringDescription 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 stringPrincipal The service that created the Hosted Zone (e.g.
servicediscovery.amazonaws.com).- Name string
- Name
Servers List<string> The list of DNS name servers for the Hosted Zone.
- Resource
Record intSet Count The number of Record Set in the Hosted Zone.
- Dictionary<string, string>
- Vpc
Id string - Zone
Id string - Private
Zone bool
- Caller
Reference 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.
- Linked
Service stringDescription 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 stringPrincipal The service that created the Hosted Zone (e.g.
servicediscovery.amazonaws.com).- Name string
- Name
Servers []string The list of DNS name servers for the Hosted Zone.
- Resource
Record intSet Count The number of Record Set in the Hosted Zone.
- map[string]string
- Vpc
Id string - Zone
Id string - Private
Zone bool
- caller
Reference 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.
- linked
Service stringDescription 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 stringPrincipal The service that created the Hosted Zone (e.g.
servicediscovery.amazonaws.com).- name string
- name
Servers string[] The list of DNS name servers for the Hosted Zone.
- resource
Record numberSet Count The number of Record Set in the Hosted Zone.
- {[key: string]: string}
- vpc
Id string - zone
Id string - private
Zone boolean
- 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_ strdescription 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_ strprincipal The service that created the Hosted Zone (e.g.
servicediscovery.amazonaws.com).- name str
- name_
servers List[str] The list of DNS name servers for the Hosted Zone.
- resource_
record_ floatset_ count The number of Record Set in the Hosted Zone.
- Dict[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
awsTerraform Provider.