Civo

v2.2.4 published on Friday, Jul 29, 2022 by Pulumi

getDnsDomainRecord

Get information on a DNS record. This data source provides the name, TTL, and zone file as configured on your Civo account.

An error will be raised if the provided domain name or record are not in your Civo account.

Example Usage

using Pulumi;
using Civo = Pulumi.Civo;

class MyStack : Stack
{
    public MyStack()
    {
        var domain = Output.Create(Civo.GetDnsDomainName.InvokeAsync(new Civo.GetDnsDomainNameArgs
        {
            Name = "domain.com",
        }));
        var www = domain.Apply(domain => Output.Create(Civo.GetDnsDomainRecord.InvokeAsync(new Civo.GetDnsDomainRecordArgs
        {
            DomainId = domain.Id,
            Name = "www",
        })));
        this.RecordType = www.Apply(www => www.Type);
        this.RecordTtl = www.Apply(www => www.Ttl);
    }

    [Output("recordType")]
    public Output<string> RecordType { get; set; }
    [Output("recordTtl")]
    public Output<string> RecordTtl { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		domain, err := civo.LookupDnsDomainName(ctx, &GetDnsDomainNameArgs{
			Name: pulumi.StringRef("domain.com"),
		}, nil)
		if err != nil {
			return err
		}
		www, err := civo.LookupDnsDomainRecord(ctx, &GetDnsDomainRecordArgs{
			DomainId: domain.Id,
			Name:     "www",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("recordType", www.Type)
		ctx.Export("recordTtl", www.Ttl)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.civo.CivoFunctions;
import com.pulumi.civo.inputs.GetDnsDomainNameArgs;
import com.pulumi.civo.inputs.GetDnsDomainRecordArgs;
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 domain = CivoFunctions.getDnsDomainName(GetDnsDomainNameArgs.builder()
            .name("domain.com")
            .build());

        final var www = CivoFunctions.getDnsDomainRecord(GetDnsDomainRecordArgs.builder()
            .domainId(domain.applyValue(getDnsDomainNameResult -> getDnsDomainNameResult.id()))
            .name("www")
            .build());

        ctx.export("recordType", www.applyValue(getDnsDomainRecordResult -> getDnsDomainRecordResult.type()));
        ctx.export("recordTtl", www.applyValue(getDnsDomainRecordResult -> getDnsDomainRecordResult.ttl()));
    }
}
import pulumi
import pulumi_civo as civo

domain = civo.get_dns_domain_name(name="domain.com")
www = civo.get_dns_domain_record(domain_id=domain.id,
    name="www")
pulumi.export("recordType", www.type)
pulumi.export("recordTtl", www.ttl)
import * as pulumi from "@pulumi/pulumi";
import * as civo from "@pulumi/civo";

const domain = civo.getDnsDomainName({
    name: "domain.com",
});
const www = domain.then(domain => civo.getDnsDomainRecord({
    domainId: domain.id,
    name: "www",
}));
export const recordType = www.then(www => www.type);
export const recordTtl = www.then(www => www.ttl);
variables:
  domain:
    Fn::Invoke:
      Function: civo:getDnsDomainName
      Arguments:
        name: domain.com
  www:
    Fn::Invoke:
      Function: civo:getDnsDomainRecord
      Arguments:
        domainId: ${domain.id}
        name: www
outputs:
  recordType: ${www.type}
  recordTtl: ${www.ttl}

Using getDnsDomainRecord

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 getDnsDomainRecord(args: GetDnsDomainRecordArgs, opts?: InvokeOptions): Promise<GetDnsDomainRecordResult>
function getDnsDomainRecordOutput(args: GetDnsDomainRecordOutputArgs, opts?: InvokeOptions): Output<GetDnsDomainRecordResult>
def get_dns_domain_record(domain_id: Optional[str] = None,
                          name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetDnsDomainRecordResult
def get_dns_domain_record_output(domain_id: Optional[pulumi.Input[str]] = None,
                          name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetDnsDomainRecordResult]
func LookupDnsDomainRecord(ctx *Context, args *LookupDnsDomainRecordArgs, opts ...InvokeOption) (*LookupDnsDomainRecordResult, error)
func LookupDnsDomainRecordOutput(ctx *Context, args *LookupDnsDomainRecordOutputArgs, opts ...InvokeOption) LookupDnsDomainRecordResultOutput

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

public static class GetDnsDomainRecord 
{
    public static Task<GetDnsDomainRecordResult> InvokeAsync(GetDnsDomainRecordArgs args, InvokeOptions? opts = null)
    public static Output<GetDnsDomainRecordResult> Invoke(GetDnsDomainRecordInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDnsDomainRecordResult> getDnsDomainRecord(GetDnsDomainRecordArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: civo:index/getDnsDomainRecord:getDnsDomainRecord
  Arguments:
    # Arguments dictionary

The following arguments are supported:

DomainId string
Name string
DomainId string
Name string
domainId String
name String
domainId string
name string
domainId String
name String

getDnsDomainRecord Result

The following output properties are available:

AccountId string
CreatedAt string
DomainId string
Id string

The provider-assigned unique ID for this managed resource.

Name string
Priority int
Ttl int
Type string
UpdatedAt string
Value string
AccountId string
CreatedAt string
DomainId string
Id string

The provider-assigned unique ID for this managed resource.

Name string
Priority int
Ttl int
Type string
UpdatedAt string
Value string
accountId String
createdAt String
domainId String
id String

The provider-assigned unique ID for this managed resource.

name String
priority Integer
ttl Integer
type String
updatedAt String
value String
accountId string
createdAt string
domainId string
id string

The provider-assigned unique ID for this managed resource.

name string
priority number
ttl number
type string
updatedAt string
value string
account_id str
created_at str
domain_id str
id str

The provider-assigned unique ID for this managed resource.

name str
priority int
ttl int
type str
updated_at str
value str
accountId String
createdAt String
domainId String
id String

The provider-assigned unique ID for this managed resource.

name String
priority Number
ttl Number
type String
updatedAt String
value String

Package Details

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

This Pulumi package is based on the civo Terraform Provider.