get Managed Zone
Provides access to a zone's attributes within Google Cloud DNS. For more information see the official documentation and API.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const envDnsZone = gcp.dns.getManagedZone({
name: "qa-zone",
});
const dns = new gcp.dns.RecordSet("dns", {
name: envDnsZone.then(envDnsZone => `my-address.${envDnsZone.dnsName}`),
type: "TXT",
ttl: 300,
managedZone: envDnsZone.then(envDnsZone => envDnsZone.name),
rrdatas: ["test"],
});
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
env_dns_zone = gcp.dns.get_managed_zone(name="qa-zone")
dns = gcp.dns.RecordSet("dns",
name=f"my-address.{env_dns_zone.dns_name}",
type="TXT",
ttl=300,
managed_zone=env_dns_zone.name,
rrdatas=["test"])
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var envDnsZone = Gcp.Dns.GetManagedZone.Invoke(new()
{
Name = "qa-zone",
});
var dns = new Gcp.Dns.RecordSet("dns", new()
{
Name = $"my-address.{envDnsZone.Apply(getManagedZoneResult => getManagedZoneResult.DnsName)}",
Type = "TXT",
Ttl = 300,
ManagedZone = envDnsZone.Apply(getManagedZoneResult => getManagedZoneResult.Name),
Rrdatas = new[]
{
"test",
},
});
});
Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/dns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
envDnsZone, err := dns.LookupManagedZone(ctx, &dns.LookupManagedZoneArgs{
Name: "qa-zone",
}, nil)
if err != nil {
return err
}
_, err = dns.NewRecordSet(ctx, "dns", &dns.RecordSetArgs{
Name: pulumi.Sprintf("my-address.%v", envDnsZone.DnsName),
Type: pulumi.String("TXT"),
Ttl: pulumi.Int(300),
ManagedZone: pulumi.String(envDnsZone.Name),
Rrdatas: pulumi.StringArray{
pulumi.String("test"),
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.dns.DnsFunctions;
import com.pulumi.gcp.dns.inputs.GetManagedZoneArgs;
import com.pulumi.gcp.dns.RecordSet;
import com.pulumi.gcp.dns.RecordSetArgs;
import java.util.List;
import java.util.ArrayList;
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) {
final var envDnsZone = DnsFunctions.getManagedZone(GetManagedZoneArgs.builder()
.name("qa-zone")
.build());
var dns = new RecordSet("dns", RecordSetArgs.builder()
.name(String.format("my-address.%s", envDnsZone.dnsName()))
.type("TXT")
.ttl(300)
.managedZone(envDnsZone.name())
.rrdatas("test")
.build());
}
}
Content copied to clipboard
resources:
dns:
type: gcp:dns:RecordSet
properties:
name: my-address.${envDnsZone.dnsName}
type: TXT
ttl: 300
managedZone: ${envDnsZone.name}
rrdatas:
- test
variables:
envDnsZone:
fn::invoke:
function: gcp:dns:getManagedZone
arguments:
name: qa-zone
Content copied to clipboard
Return
A collection of values returned by getManagedZone.
Parameters
argument
A collection of arguments for invoking getManagedZone.
Return
A collection of values returned by getManagedZone.
Parameters
name
A unique name for the resource.
project
The ID of the project for the Google Cloud DNS zone. If this is not provided the default project will be used.
See also
suspend fun getManagedZone(argument: suspend GetManagedZonePlainArgsBuilder.() -> Unit): GetManagedZoneResult
Return
A collection of values returned by getManagedZone.
Parameters
argument
Builder for com.pulumi.gcp.dns.kotlin.inputs.GetManagedZonePlainArgs.