get Dns Zone
Use this data source to access information about an existing Private DNS Zone.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.privatedns.getDnsZone({
name: "contoso.internal",
resourceGroupName: "contoso-dns",
});
export const privateDnsZoneId = example.then(example => example.id);
Content copied to clipboard
import pulumi
import pulumi_azure as azure
example = azure.privatedns.get_dns_zone(name="contoso.internal",
resource_group_name="contoso-dns")
pulumi.export("privateDnsZoneId", example.id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.PrivateDns.GetDnsZone.Invoke(new()
{
Name = "contoso.internal",
ResourceGroupName = "contoso-dns",
});
return new Dictionary<string, object?>
{
["privateDnsZoneId"] = example.Apply(getDnsZoneResult => getDnsZoneResult.Id),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/privatedns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := privatedns.GetDnsZone(ctx, &privatedns.GetDnsZoneArgs{
Name: "contoso.internal",
ResourceGroupName: pulumi.StringRef("contoso-dns"),
}, nil)
if err != nil {
return err
}
ctx.Export("privateDnsZoneId", example.Id)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.privatedns.PrivatednsFunctions;
import com.pulumi.azure.privatedns.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 = PrivatednsFunctions.getDnsZone(GetDnsZoneArgs.builder()
.name("contoso.internal")
.resourceGroupName("contoso-dns")
.build());
ctx.export("privateDnsZoneId", example.applyValue(getDnsZoneResult -> getDnsZoneResult.id()));
}
}
Content copied to clipboard
variables:
example:
fn::invoke:
function: azure:privatedns:getDnsZone
arguments:
name: contoso.internal
resourceGroupName: contoso-dns
outputs:
privateDnsZoneId: ${example.id}
Content copied to clipboard
Return
A collection of values returned by getDnsZone.
Parameters
argument
A collection of arguments for invoking getDnsZone.
suspend fun getDnsZone(name: String, resourceGroupName: String? = null, tags: Map<String, String>? = null): GetDnsZoneResult
Return
A collection of values returned by getDnsZone.
Parameters
name
The name of the Private DNS Zone.
resource Group Name
The Name of the Resource Group where the Private DNS Zone exists. If the Name of the Resource Group is not provided, the first Private DNS Zone from the list of Private DNS Zones in your subscription that matches name
will be returned.
tags
A mapping of tags for the zone.
See also
Return
A collection of values returned by getDnsZone.
Parameters
argument
Builder for com.pulumi.azure.privatedns.kotlin.inputs.GetDnsZonePlainArgs.