1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. getDnsRecord
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.getDnsRecord

Explore with Pulumi AI

The DNS Record can be used to search for and return an existing DNS Record. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search and make sure that your resources have unique names.

⚠️ Only tokens are accepted for authorization in the ionoscloud_dns_record data source. Please ensure you are using tokens as other methods will not be valid.

Example Usage

By ID

import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";

const example = ionoscloud.getDnsRecord({
    id: "record_id",
    zoneId: "zone_id",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_dns_record(id="record_id",
    zone_id="zone_id")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ionoscloud.LookupDnsRecord(ctx, &ionoscloud.LookupDnsRecordArgs{
			Id:     pulumi.StringRef("record_id"),
			ZoneId: "zone_id",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;

return await Deployment.RunAsync(() => 
{
    var example = Ionoscloud.GetDnsRecord.Invoke(new()
    {
        Id = "record_id",
        ZoneId = "zone_id",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetDnsRecordArgs;
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 example = IonoscloudFunctions.getDnsRecord(GetDnsRecordArgs.builder()
            .id("record_id")
            .zoneId("zone_id")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getDnsRecord
      arguments:
        id: record_id
        zoneId: zone_id
Copy

By name

import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";

const example = ionoscloud.getDnsRecord({
    name: "recordexample",
    zoneId: "zone_id",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_dns_record(name="recordexample",
    zone_id="zone_id")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ionoscloud.LookupDnsRecord(ctx, &ionoscloud.LookupDnsRecordArgs{
			Name:   pulumi.StringRef("recordexample"),
			ZoneId: "zone_id",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;

return await Deployment.RunAsync(() => 
{
    var example = Ionoscloud.GetDnsRecord.Invoke(new()
    {
        Name = "recordexample",
        ZoneId = "zone_id",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetDnsRecordArgs;
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 example = IonoscloudFunctions.getDnsRecord(GetDnsRecordArgs.builder()
            .name("recordexample")
            .zoneId("zone_id")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getDnsRecord
      arguments:
        name: recordexample
        zoneId: zone_id
Copy

By name with partial match

import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";

const example = ionoscloud.getDnsRecord({
    name: "record",
    partialMatch: true,
    zoneId: "zone_id",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_dns_record(name="record",
    partial_match=True,
    zone_id="zone_id")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ionoscloud.LookupDnsRecord(ctx, &ionoscloud.LookupDnsRecordArgs{
			Name:         pulumi.StringRef("record"),
			PartialMatch: pulumi.BoolRef(true),
			ZoneId:       "zone_id",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;

return await Deployment.RunAsync(() => 
{
    var example = Ionoscloud.GetDnsRecord.Invoke(new()
    {
        Name = "record",
        PartialMatch = true,
        ZoneId = "zone_id",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetDnsRecordArgs;
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 example = IonoscloudFunctions.getDnsRecord(GetDnsRecordArgs.builder()
            .name("record")
            .partialMatch(true)
            .zoneId("zone_id")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getDnsRecord
      arguments:
        name: record
        partialMatch: true
        zoneId: zone_id
Copy

Using getDnsRecord

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 getDnsRecord(args: GetDnsRecordArgs, opts?: InvokeOptions): Promise<GetDnsRecordResult>
function getDnsRecordOutput(args: GetDnsRecordOutputArgs, opts?: InvokeOptions): Output<GetDnsRecordResult>
Copy
def get_dns_record(id: Optional[str] = None,
                   name: Optional[str] = None,
                   partial_match: Optional[bool] = None,
                   timeouts: Optional[GetDnsRecordTimeouts] = None,
                   zone_id: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetDnsRecordResult
def get_dns_record_output(id: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   partial_match: Optional[pulumi.Input[bool]] = None,
                   timeouts: Optional[pulumi.Input[GetDnsRecordTimeoutsArgs]] = None,
                   zone_id: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetDnsRecordResult]
Copy
func LookupDnsRecord(ctx *Context, args *LookupDnsRecordArgs, opts ...InvokeOption) (*LookupDnsRecordResult, error)
func LookupDnsRecordOutput(ctx *Context, args *LookupDnsRecordOutputArgs, opts ...InvokeOption) LookupDnsRecordResultOutput
Copy

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

public static class GetDnsRecord 
{
    public static Task<GetDnsRecordResult> InvokeAsync(GetDnsRecordArgs args, InvokeOptions? opts = null)
    public static Output<GetDnsRecordResult> Invoke(GetDnsRecordInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDnsRecordResult> getDnsRecord(GetDnsRecordArgs args, InvokeOptions options)
public static Output<GetDnsRecordResult> getDnsRecord(GetDnsRecordArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ionoscloud:index/getDnsRecord:getDnsRecord
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ZoneId This property is required. string
[string] The ID of the DNS Zone in which the DNS Record can be found.
Id string
[string] The ID of the DNS Record you want to search for.
Name string
[string] The name of the DNS Record you want to search for.
PartialMatch bool

[bool] Whether partial matching is allowed or not when using name argument. Default value is false.

Either id or name must be provided. If none, or both are provided, the datasource will return an error.

Timeouts GetDnsRecordTimeouts
ZoneId This property is required. string
[string] The ID of the DNS Zone in which the DNS Record can be found.
Id string
[string] The ID of the DNS Record you want to search for.
Name string
[string] The name of the DNS Record you want to search for.
PartialMatch bool

[bool] Whether partial matching is allowed or not when using name argument. Default value is false.

Either id or name must be provided. If none, or both are provided, the datasource will return an error.

Timeouts GetDnsRecordTimeouts
zoneId This property is required. String
[string] The ID of the DNS Zone in which the DNS Record can be found.
id String
[string] The ID of the DNS Record you want to search for.
name String
[string] The name of the DNS Record you want to search for.
partialMatch Boolean

[bool] Whether partial matching is allowed or not when using name argument. Default value is false.

Either id or name must be provided. If none, or both are provided, the datasource will return an error.

timeouts GetDnsRecordTimeouts
zoneId This property is required. string
[string] The ID of the DNS Zone in which the DNS Record can be found.
id string
[string] The ID of the DNS Record you want to search for.
name string
[string] The name of the DNS Record you want to search for.
partialMatch boolean

[bool] Whether partial matching is allowed or not when using name argument. Default value is false.

Either id or name must be provided. If none, or both are provided, the datasource will return an error.

timeouts GetDnsRecordTimeouts
zone_id This property is required. str
[string] The ID of the DNS Zone in which the DNS Record can be found.
id str
[string] The ID of the DNS Record you want to search for.
name str
[string] The name of the DNS Record you want to search for.
partial_match bool

[bool] Whether partial matching is allowed or not when using name argument. Default value is false.

Either id or name must be provided. If none, or both are provided, the datasource will return an error.

timeouts GetDnsRecordTimeouts
zoneId This property is required. String
[string] The ID of the DNS Zone in which the DNS Record can be found.
id String
[string] The ID of the DNS Record you want to search for.
name String
[string] The name of the DNS Record you want to search for.
partialMatch Boolean

[bool] Whether partial matching is allowed or not when using name argument. Default value is false.

Either id or name must be provided. If none, or both are provided, the datasource will return an error.

timeouts Property Map

getDnsRecord Result

The following output properties are available:

Content string
The content of the DNS Record.
Enabled bool
Indicates if the DNS Record is active or not.
Fqdn string
Id string
The UUID of the DNS Record.
Name string
The name of the DNS Record.
Priority double
The priority for the DNS Record.
Ttl double
The time to live of the DNS Record.
Type string
The type of the DNS Record.
ZoneId string
PartialMatch bool
Timeouts GetDnsRecordTimeouts
Content string
The content of the DNS Record.
Enabled bool
Indicates if the DNS Record is active or not.
Fqdn string
Id string
The UUID of the DNS Record.
Name string
The name of the DNS Record.
Priority float64
The priority for the DNS Record.
Ttl float64
The time to live of the DNS Record.
Type string
The type of the DNS Record.
ZoneId string
PartialMatch bool
Timeouts GetDnsRecordTimeouts
content String
The content of the DNS Record.
enabled Boolean
Indicates if the DNS Record is active or not.
fqdn String
id String
The UUID of the DNS Record.
name String
The name of the DNS Record.
priority Double
The priority for the DNS Record.
ttl Double
The time to live of the DNS Record.
type String
The type of the DNS Record.
zoneId String
partialMatch Boolean
timeouts GetDnsRecordTimeouts
content string
The content of the DNS Record.
enabled boolean
Indicates if the DNS Record is active or not.
fqdn string
id string
The UUID of the DNS Record.
name string
The name of the DNS Record.
priority number
The priority for the DNS Record.
ttl number
The time to live of the DNS Record.
type string
The type of the DNS Record.
zoneId string
partialMatch boolean
timeouts GetDnsRecordTimeouts
content str
The content of the DNS Record.
enabled bool
Indicates if the DNS Record is active or not.
fqdn str
id str
The UUID of the DNS Record.
name str
The name of the DNS Record.
priority float
The priority for the DNS Record.
ttl float
The time to live of the DNS Record.
type str
The type of the DNS Record.
zone_id str
partial_match bool
timeouts GetDnsRecordTimeouts
content String
The content of the DNS Record.
enabled Boolean
Indicates if the DNS Record is active or not.
fqdn String
id String
The UUID of the DNS Record.
name String
The name of the DNS Record.
priority Number
The priority for the DNS Record.
ttl Number
The time to live of the DNS Record.
type String
The type of the DNS Record.
zoneId String
partialMatch Boolean
timeouts Property Map

Supporting Types

GetDnsRecordTimeouts

Create string
Default string
Delete string
Update string
Create string
Default string
Delete string
Update string
create String
default_ String
delete String
update String
create string
default string
delete string
update string
create String
default String
delete String
update String

Package Details

Repository
ionoscloud ionos-cloud/terraform-provider-ionoscloud
License
Notes
This Pulumi package is based on the ionoscloud Terraform Provider.