Google Cloud v8.14.0 published on Wednesday, Jan 15, 2025 by Pulumi
gcp.dns.getRecordSet
Explore with Pulumi AI
Get a DNS record set within Google Cloud DNS For more information see the official documentation and API
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const sample = gcp.dns.getManagedZone({
    name: "sample-zone",
});
const rs = Promise.all([sample, sample]).then(([sample, sample1]) => gcp.dns.getRecordSet({
    managedZone: sample.name,
    name: `my-record.${sample1.dnsName}`,
    type: "A",
}));
import pulumi
import pulumi_gcp as gcp
sample = gcp.dns.get_managed_zone(name="sample-zone")
rs = gcp.dns.get_record_set(managed_zone=sample.name,
    name=f"my-record.{sample.dns_name}",
    type="A")
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 {
		sample, err := dns.LookupManagedZone(ctx, &dns.LookupManagedZoneArgs{
			Name: "sample-zone",
		}, nil)
		if err != nil {
			return err
		}
		_, err = dns.LookupRecordSet(ctx, &dns.LookupRecordSetArgs{
			ManagedZone: sample.Name,
			Name:        fmt.Sprintf("my-record.%v", sample.DnsName),
			Type:        "A",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var sample = Gcp.Dns.GetManagedZone.Invoke(new()
    {
        Name = "sample-zone",
    });
    var rs = Gcp.Dns.GetRecordSet.Invoke(new()
    {
        ManagedZone = sample.Apply(getManagedZoneResult => getManagedZoneResult.Name),
        Name = $"my-record.{sample.Apply(getManagedZoneResult => getManagedZoneResult.DnsName)}",
        Type = "A",
    });
});
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.inputs.GetRecordSetArgs;
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 sample = DnsFunctions.getManagedZone(GetManagedZoneArgs.builder()
            .name("sample-zone")
            .build());
        final var rs = DnsFunctions.getRecordSet(GetRecordSetArgs.builder()
            .managedZone(sample.applyValue(getManagedZoneResult -> getManagedZoneResult.name()))
            .name(String.format("my-record.%s", sample.applyValue(getManagedZoneResult -> getManagedZoneResult.dnsName())))
            .type("A")
            .build());
    }
}
variables:
  sample:
    fn::invoke:
      function: gcp:dns:getManagedZone
      arguments:
        name: sample-zone
  rs:
    fn::invoke:
      function: gcp:dns:getRecordSet
      arguments:
        managedZone: ${sample.name}
        name: my-record.${sample.dnsName}
        type: A
Using getRecordSet
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 getRecordSet(args: GetRecordSetArgs, opts?: InvokeOptions): Promise<GetRecordSetResult>
function getRecordSetOutput(args: GetRecordSetOutputArgs, opts?: InvokeOptions): Output<GetRecordSetResult>def get_record_set(managed_zone: Optional[str] = None,
                   name: Optional[str] = None,
                   project: Optional[str] = None,
                   type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetRecordSetResult
def get_record_set_output(managed_zone: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   type: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetRecordSetResult]func LookupRecordSet(ctx *Context, args *LookupRecordSetArgs, opts ...InvokeOption) (*LookupRecordSetResult, error)
func LookupRecordSetOutput(ctx *Context, args *LookupRecordSetOutputArgs, opts ...InvokeOption) LookupRecordSetResultOutput> Note: This function is named LookupRecordSet in the Go SDK.
public static class GetRecordSet 
{
    public static Task<GetRecordSetResult> InvokeAsync(GetRecordSetArgs args, InvokeOptions? opts = null)
    public static Output<GetRecordSetResult> Invoke(GetRecordSetInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRecordSetResult> getRecordSet(GetRecordSetArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gcp:dns/getRecordSet:getRecordSet
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Managed
Zone string - The Name of the zone.
 - Name string
 - The DNS name for the resource.
 - Type string
 - The RRSet type. See this table for supported types.
 - Project string
 - The ID of the project for the Google Cloud.
 
- Managed
Zone string - The Name of the zone.
 - Name string
 - The DNS name for the resource.
 - Type string
 - The RRSet type. See this table for supported types.
 - Project string
 - The ID of the project for the Google Cloud.
 
- managed
Zone String - The Name of the zone.
 - name String
 - The DNS name for the resource.
 - type String
 - The RRSet type. See this table for supported types.
 - project String
 - The ID of the project for the Google Cloud.
 
- managed
Zone string - The Name of the zone.
 - name string
 - The DNS name for the resource.
 - type string
 - The RRSet type. See this table for supported types.
 - project string
 - The ID of the project for the Google Cloud.
 
- managed_
zone str - The Name of the zone.
 - name str
 - The DNS name for the resource.
 - type str
 - The RRSet type. See this table for supported types.
 - project str
 - The ID of the project for the Google Cloud.
 
- managed
Zone String - The Name of the zone.
 - name String
 - The DNS name for the resource.
 - type String
 - The RRSet type. See this table for supported types.
 - project String
 - The ID of the project for the Google Cloud.
 
getRecordSet Result
The following output properties are available:
Package Details
- Repository
 - Google Cloud (GCP) Classic pulumi/pulumi-gcp
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
google-betaTerraform Provider.