azure.network.VirtualNetworkDnsServers

Explore with Pulumi AI

Import

Virtual Network DNS Servers can be imported using the resource id, e.g.

 $ pulumi import azure:network/virtualNetworkDnsServers:VirtualNetworkDnsServers exampleNetwork /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/dnsServers/default

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("exampleVirtualNetwork", new()
    {
        AddressSpaces = new[]
        {
            "10.0.0.0/16",
        },
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        Subnets = new[]
        {
            new Azure.Network.Inputs.VirtualNetworkSubnetArgs
            {
                Name = "subnet1",
                AddressPrefix = "10.0.1.0/24",
            },
        },
    });

    var exampleVirtualNetworkDnsServers = new Azure.Network.VirtualNetworkDnsServers("exampleVirtualNetworkDnsServers", new()
    {
        VirtualNetworkId = exampleVirtualNetwork.Id,
        DnsServers = new[]
        {
            "10.7.7.2",
            "10.7.7.7",
            "10.7.7.1",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "exampleVirtualNetwork", &network.VirtualNetworkArgs{
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.0.0/16"),
			},
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			Subnets: network.VirtualNetworkSubnetArray{
				&network.VirtualNetworkSubnetArgs{
					Name:          pulumi.String("subnet1"),
					AddressPrefix: pulumi.String("10.0.1.0/24"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkDnsServers(ctx, "exampleVirtualNetworkDnsServers", &network.VirtualNetworkDnsServersArgs{
			VirtualNetworkId: exampleVirtualNetwork.ID(),
			DnsServers: pulumi.StringArray{
				pulumi.String("10.7.7.2"),
				pulumi.String("10.7.7.7"),
				pulumi.String("10.7.7.1"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.inputs.VirtualNetworkSubnetArgs;
import com.pulumi.azure.network.VirtualNetworkDnsServers;
import com.pulumi.azure.network.VirtualNetworkDnsServersArgs;
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) {
        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()        
            .addressSpaces("10.0.0.0/16")
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .subnets(VirtualNetworkSubnetArgs.builder()
                .name("subnet1")
                .addressPrefix("10.0.1.0/24")
                .build())
            .build());

        var exampleVirtualNetworkDnsServers = new VirtualNetworkDnsServers("exampleVirtualNetworkDnsServers", VirtualNetworkDnsServersArgs.builder()        
            .virtualNetworkId(exampleVirtualNetwork.id())
            .dnsServers(            
                "10.7.7.2",
                "10.7.7.7",
                "10.7.7.1")
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
    address_spaces=["10.0.0.0/16"],
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    subnets=[azure.network.VirtualNetworkSubnetArgs(
        name="subnet1",
        address_prefix="10.0.1.0/24",
    )])
example_virtual_network_dns_servers = azure.network.VirtualNetworkDnsServers("exampleVirtualNetworkDnsServers",
    virtual_network_id=example_virtual_network.id,
    dns_servers=[
        "10.7.7.2",
        "10.7.7.7",
        "10.7.7.1",
    ])
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleVirtualNetwork = new azure.network.VirtualNetwork("exampleVirtualNetwork", {
    addressSpaces: ["10.0.0.0/16"],
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    subnets: [{
        name: "subnet1",
        addressPrefix: "10.0.1.0/24",
    }],
});
const exampleVirtualNetworkDnsServers = new azure.network.VirtualNetworkDnsServers("exampleVirtualNetworkDnsServers", {
    virtualNetworkId: exampleVirtualNetwork.id,
    dnsServers: [
        "10.7.7.2",
        "10.7.7.7",
        "10.7.7.1",
    ],
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleVirtualNetwork:
    type: azure:network:VirtualNetwork
    properties:
      addressSpaces:
        - 10.0.0.0/16
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      subnets:
        - name: subnet1
          addressPrefix: 10.0.1.0/24
  exampleVirtualNetworkDnsServers:
    type: azure:network:VirtualNetworkDnsServers
    properties:
      virtualNetworkId: ${exampleVirtualNetwork.id}
      dnsServers:
        - 10.7.7.2
        - 10.7.7.7
        - 10.7.7.1

Create VirtualNetworkDnsServers Resource

new VirtualNetworkDnsServers(name: string, args: VirtualNetworkDnsServersArgs, opts?: CustomResourceOptions);
@overload
def VirtualNetworkDnsServers(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             dns_servers: Optional[Sequence[str]] = None,
                             virtual_network_id: Optional[str] = None)
@overload
def VirtualNetworkDnsServers(resource_name: str,
                             args: VirtualNetworkDnsServersArgs,
                             opts: Optional[ResourceOptions] = None)
func NewVirtualNetworkDnsServers(ctx *Context, name string, args VirtualNetworkDnsServersArgs, opts ...ResourceOption) (*VirtualNetworkDnsServers, error)
public VirtualNetworkDnsServers(string name, VirtualNetworkDnsServersArgs args, CustomResourceOptions? opts = null)
public VirtualNetworkDnsServers(String name, VirtualNetworkDnsServersArgs args)
public VirtualNetworkDnsServers(String name, VirtualNetworkDnsServersArgs args, CustomResourceOptions options)
type: azure:network:VirtualNetworkDnsServers
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args VirtualNetworkDnsServersArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args VirtualNetworkDnsServersArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args VirtualNetworkDnsServersArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VirtualNetworkDnsServersArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args VirtualNetworkDnsServersArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

VirtualNetworkDnsServers Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The VirtualNetworkDnsServers resource accepts the following input properties:

VirtualNetworkId string

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

DnsServers List<string>

List of IP addresses of DNS servers

VirtualNetworkId string

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

DnsServers []string

List of IP addresses of DNS servers

virtualNetworkId String

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dnsServers List<String>

List of IP addresses of DNS servers

virtualNetworkId string

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dnsServers string[]

List of IP addresses of DNS servers

virtual_network_id str

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dns_servers Sequence[str]

List of IP addresses of DNS servers

virtualNetworkId String

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dnsServers List<String>

List of IP addresses of DNS servers

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualNetworkDnsServers resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing VirtualNetworkDnsServers Resource

Get an existing VirtualNetworkDnsServers resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VirtualNetworkDnsServersState, opts?: CustomResourceOptions): VirtualNetworkDnsServers
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        dns_servers: Optional[Sequence[str]] = None,
        virtual_network_id: Optional[str] = None) -> VirtualNetworkDnsServers
func GetVirtualNetworkDnsServers(ctx *Context, name string, id IDInput, state *VirtualNetworkDnsServersState, opts ...ResourceOption) (*VirtualNetworkDnsServers, error)
public static VirtualNetworkDnsServers Get(string name, Input<string> id, VirtualNetworkDnsServersState? state, CustomResourceOptions? opts = null)
public static VirtualNetworkDnsServers get(String name, Output<String> id, VirtualNetworkDnsServersState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
DnsServers List<string>

List of IP addresses of DNS servers

VirtualNetworkId string

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

DnsServers []string

List of IP addresses of DNS servers

VirtualNetworkId string

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dnsServers List<String>

List of IP addresses of DNS servers

virtualNetworkId String

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dnsServers string[]

List of IP addresses of DNS servers

virtualNetworkId string

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dns_servers Sequence[str]

List of IP addresses of DNS servers

virtual_network_id str

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

dnsServers List<String>

List of IP addresses of DNS servers

virtualNetworkId String

The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.