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

ionoscloud.getDnsZone

Explore with Pulumi AI

The DNS Zone can be used to search for and return an existing DNS Zone. 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_zone 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.getDnsZone({
    id: "zone_id",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_dns_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.LookupDnsZone(ctx, &ionoscloud.LookupDnsZoneArgs{
			Id: pulumi.StringRef("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.GetDnsZone.Invoke(new()
    {
        Id = "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.GetDnsZoneArgs;
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.getDnsZone(GetDnsZoneArgs.builder()
            .id("zone_id")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getDnsZone
      arguments:
        id: zone_id
Copy

By name

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

const example = ionoscloud.getDnsZone({
    name: "example.com",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_dns_zone(name="example.com")
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.LookupDnsZone(ctx, &ionoscloud.LookupDnsZoneArgs{
			Name: pulumi.StringRef("example.com"),
		}, 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.GetDnsZone.Invoke(new()
    {
        Name = "example.com",
    });

});
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.GetDnsZoneArgs;
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.getDnsZone(GetDnsZoneArgs.builder()
            .name("example.com")
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getDnsZone
      arguments:
        name: example.com
Copy

By name with partial match

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

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

example = ionoscloud.get_dns_zone(name="example",
    partial_match=True)
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.LookupDnsZone(ctx, &ionoscloud.LookupDnsZoneArgs{
			Name:         pulumi.StringRef("example"),
			PartialMatch: pulumi.BoolRef(true),
		}, 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.GetDnsZone.Invoke(new()
    {
        Name = "example",
        PartialMatch = true,
    });

});
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.GetDnsZoneArgs;
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.getDnsZone(GetDnsZoneArgs.builder()
            .name("example")
            .partialMatch(true)
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getDnsZone
      arguments:
        name: example
        partialMatch: true
Copy

Using getDnsZone

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 getDnsZone(args: GetDnsZoneArgs, opts?: InvokeOptions): Promise<GetDnsZoneResult>
function getDnsZoneOutput(args: GetDnsZoneOutputArgs, opts?: InvokeOptions): Output<GetDnsZoneResult>
Copy
def get_dns_zone(id: Optional[str] = None,
                 name: Optional[str] = None,
                 partial_match: Optional[bool] = None,
                 opts: Optional[InvokeOptions] = None) -> GetDnsZoneResult
def get_dns_zone_output(id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 partial_match: Optional[pulumi.Input[bool]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetDnsZoneResult]
Copy
func LookupDnsZone(ctx *Context, args *LookupDnsZoneArgs, opts ...InvokeOption) (*LookupDnsZoneResult, error)
func LookupDnsZoneOutput(ctx *Context, args *LookupDnsZoneOutputArgs, opts ...InvokeOption) LookupDnsZoneResultOutput
Copy

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

public static class GetDnsZone 
{
    public static Task<GetDnsZoneResult> InvokeAsync(GetDnsZoneArgs args, InvokeOptions? opts = null)
    public static Output<GetDnsZoneResult> Invoke(GetDnsZoneInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDnsZoneResult> getDnsZone(GetDnsZoneArgs args, InvokeOptions options)
public static Output<GetDnsZoneResult> getDnsZone(GetDnsZoneArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ionoscloud:index/getDnsZone:getDnsZone
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Id string
[string] The ID of the DNS Zone you want to search for.
Name string
[string] The name of the DNS Zone 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.

Id string
[string] The ID of the DNS Zone you want to search for.
Name string
[string] The name of the DNS Zone 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.

id String
[string] The ID of the DNS Zone you want to search for.
name String
[string] The name of the DNS Zone 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.

id string
[string] The ID of the DNS Zone you want to search for.
name string
[string] The name of the DNS Zone 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.

id str
[string] The ID of the DNS Zone you want to search for.
name str
[string] The name of the DNS Zone 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.

id String
[string] The ID of the DNS Zone you want to search for.
name String
[string] The name of the DNS Zone 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.

getDnsZone Result

The following output properties are available:

Description string
The description of the DNS Zone.
Enabled bool
Indicates if the DNS Zone is activated or not.
Id string
The UUID of the DNS Zone.
Name string
The name of the DNS Zone.
Nameservers List<string>
A list of available name servers.
PartialMatch bool
Description string
The description of the DNS Zone.
Enabled bool
Indicates if the DNS Zone is activated or not.
Id string
The UUID of the DNS Zone.
Name string
The name of the DNS Zone.
Nameservers []string
A list of available name servers.
PartialMatch bool
description String
The description of the DNS Zone.
enabled Boolean
Indicates if the DNS Zone is activated or not.
id String
The UUID of the DNS Zone.
name String
The name of the DNS Zone.
nameservers List<String>
A list of available name servers.
partialMatch Boolean
description string
The description of the DNS Zone.
enabled boolean
Indicates if the DNS Zone is activated or not.
id string
The UUID of the DNS Zone.
name string
The name of the DNS Zone.
nameservers string[]
A list of available name servers.
partialMatch boolean
description str
The description of the DNS Zone.
enabled bool
Indicates if the DNS Zone is activated or not.
id str
The UUID of the DNS Zone.
name str
The name of the DNS Zone.
nameservers Sequence[str]
A list of available name servers.
partial_match bool
description String
The description of the DNS Zone.
enabled Boolean
Indicates if the DNS Zone is activated or not.
id String
The UUID of the DNS Zone.
name String
The name of the DNS Zone.
nameservers List<String>
A list of available name servers.
partialMatch Boolean

Package Details

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