Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.32.0 published on Wednesday, Jul 20, 2022 by Pulumi

getManagedZone

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"],
});
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"])
using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var envDnsZone = Output.Create(Gcp.Dns.GetManagedZone.InvokeAsync(new Gcp.Dns.GetManagedZoneArgs
        {
            Name = "qa-zone",
        }));
        var dns = new Gcp.Dns.RecordSet("dns", new Gcp.Dns.RecordSetArgs
        {
            Name = envDnsZone.Apply(envDnsZone => $"my-address.{envDnsZone.DnsName}"),
            Type = "TXT",
            Ttl = 300,
            ManagedZone = envDnsZone.Apply(envDnsZone => envDnsZone.Name),
            Rrdatas = 
            {
                "test",
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v6/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.String(fmt.Sprintf("%v%v", "my-address.", 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
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var envDnsZone = Output.of(DnsFunctions.getManagedZone(GetManagedZoneArgs.builder()
            .name("qa-zone")
            .build()));

        var dns = new RecordSet("dns", RecordSetArgs.builder()        
            .name(String.format("my-address.%s", envDnsZone.apply(getManagedZoneResult -> getManagedZoneResult.dnsName())))
            .type("TXT")
            .ttl(300)
            .managedZone(envDnsZone.apply(getManagedZoneResult -> getManagedZoneResult.name()))
            .rrdatas("test")
            .build());

    }
}
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

Using getManagedZone

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 getManagedZone(args: GetManagedZoneArgs, opts?: InvokeOptions): Promise<GetManagedZoneResult>
function getManagedZoneOutput(args: GetManagedZoneOutputArgs, opts?: InvokeOptions): Output<GetManagedZoneResult>
def get_managed_zone(name: Optional[str] = None,
                     project: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetManagedZoneResult
def get_managed_zone_output(name: Optional[pulumi.Input[str]] = None,
                     project: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetManagedZoneResult]
func LookupManagedZone(ctx *Context, args *LookupManagedZoneArgs, opts ...InvokeOption) (*LookupManagedZoneResult, error)
func LookupManagedZoneOutput(ctx *Context, args *LookupManagedZoneOutputArgs, opts ...InvokeOption) LookupManagedZoneResultOutput

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

public static class GetManagedZone 
{
    public static Task<GetManagedZoneResult> InvokeAsync(GetManagedZoneArgs args, InvokeOptions? opts = null)
    public static Output<GetManagedZoneResult> Invoke(GetManagedZoneInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetManagedZoneResult> getManagedZone(GetManagedZoneArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:dns/getManagedZone:getManagedZone
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

A unique name for the resource.

Project string

The ID of the project for the Google Cloud DNS zone.

Name string

A unique name for the resource.

Project string

The ID of the project for the Google Cloud DNS zone.

name String

A unique name for the resource.

project String

The ID of the project for the Google Cloud DNS zone.

name string

A unique name for the resource.

project string

The ID of the project for the Google Cloud DNS zone.

name str

A unique name for the resource.

project str

The ID of the project for the Google Cloud DNS zone.

name String

A unique name for the resource.

project String

The ID of the project for the Google Cloud DNS zone.

getManagedZone Result

The following output properties are available:

Description string

A textual description field.

DnsName string

The fully qualified DNS name of this zone, e.g. example.io..

Id string

The provider-assigned unique ID for this managed resource.

Name string
NameServers List<string>

The list of nameservers that will be authoritative for this domain. Use NS records to redirect from your DNS provider to these names, thus making Google Cloud DNS authoritative for this zone.

Visibility string

The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources.

Project string
Description string

A textual description field.

DnsName string

The fully qualified DNS name of this zone, e.g. example.io..

Id string

The provider-assigned unique ID for this managed resource.

Name string
NameServers []string

The list of nameservers that will be authoritative for this domain. Use NS records to redirect from your DNS provider to these names, thus making Google Cloud DNS authoritative for this zone.

Visibility string

The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources.

Project string
description String

A textual description field.

dnsName String

The fully qualified DNS name of this zone, e.g. example.io..

id String

The provider-assigned unique ID for this managed resource.

name String
nameServers List<String>

The list of nameservers that will be authoritative for this domain. Use NS records to redirect from your DNS provider to these names, thus making Google Cloud DNS authoritative for this zone.

visibility String

The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources.

project String
description string

A textual description field.

dnsName string

The fully qualified DNS name of this zone, e.g. example.io..

id string

The provider-assigned unique ID for this managed resource.

name string
nameServers string[]

The list of nameservers that will be authoritative for this domain. Use NS records to redirect from your DNS provider to these names, thus making Google Cloud DNS authoritative for this zone.

visibility string

The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources.

project string
description str

A textual description field.

dns_name str

The fully qualified DNS name of this zone, e.g. example.io..

id str

The provider-assigned unique ID for this managed resource.

name str
name_servers Sequence[str]

The list of nameservers that will be authoritative for this domain. Use NS records to redirect from your DNS provider to these names, thus making Google Cloud DNS authoritative for this zone.

visibility str

The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources.

project str
description String

A textual description field.

dnsName String

The fully qualified DNS name of this zone, e.g. example.io..

id String

The provider-assigned unique ID for this managed resource.

name String
nameServers List<String>

The list of nameservers that will be authoritative for this domain. Use NS records to redirect from your DNS provider to these names, thus making Google Cloud DNS authoritative for this zone.

visibility String

The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources.

project String

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.