1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. dns
  5. getRecordSet
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.dns.getRecordSet

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    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 dictionary

    The following arguments are supported:

    ManagedZone 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.
    ManagedZone 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.
    managedZone 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.
    managedZone 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.
    managedZone 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:

    Id string
    The provider-assigned unique ID for this managed resource.
    ManagedZone string
    Name string
    Rrdatas List<string>
    The string data for the records in this record set.
    Ttl int
    The time-to-live of this record set (seconds).
    Type string
    Project string
    Id string
    The provider-assigned unique ID for this managed resource.
    ManagedZone string
    Name string
    Rrdatas []string
    The string data for the records in this record set.
    Ttl int
    The time-to-live of this record set (seconds).
    Type string
    Project string
    id String
    The provider-assigned unique ID for this managed resource.
    managedZone String
    name String
    rrdatas List<String>
    The string data for the records in this record set.
    ttl Integer
    The time-to-live of this record set (seconds).
    type String
    project String
    id string
    The provider-assigned unique ID for this managed resource.
    managedZone string
    name string
    rrdatas string[]
    The string data for the records in this record set.
    ttl number
    The time-to-live of this record set (seconds).
    type string
    project string
    id str
    The provider-assigned unique ID for this managed resource.
    managed_zone str
    name str
    rrdatas Sequence[str]
    The string data for the records in this record set.
    ttl int
    The time-to-live of this record set (seconds).
    type str
    project str
    id String
    The provider-assigned unique ID for this managed resource.
    managedZone String
    name String
    rrdatas List<String>
    The string data for the records in this record set.
    ttl Number
    The time-to-live of this record set (seconds).
    type String
    project String

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi