1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. dns
  5. Policy
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

gcp.dns.Policy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

    A policy is a collection of DNS rules applied to one or more Virtual Private Cloud resources.

    To get more information about Policy, see:

    Example Usage

    Dns Policy Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const network_1 = new gcp.compute.Network("network-1", {
        name: "network-1",
        autoCreateSubnetworks: false,
    });
    const network_2 = new gcp.compute.Network("network-2", {
        name: "network-2",
        autoCreateSubnetworks: false,
    });
    const example_policy = new gcp.dns.Policy("example-policy", {
        name: "example-policy",
        enableInboundForwarding: true,
        enableLogging: true,
        alternativeNameServerConfig: {
            targetNameServers: [
                {
                    ipv4Address: "172.16.1.10",
                    forwardingPath: "private",
                },
                {
                    ipv4Address: "172.16.1.20",
                },
            ],
        },
        networks: [
            {
                networkUrl: network_1.id,
            },
            {
                networkUrl: network_2.id,
            },
        ],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    network_1 = gcp.compute.Network("network-1",
        name="network-1",
        auto_create_subnetworks=False)
    network_2 = gcp.compute.Network("network-2",
        name="network-2",
        auto_create_subnetworks=False)
    example_policy = gcp.dns.Policy("example-policy",
        name="example-policy",
        enable_inbound_forwarding=True,
        enable_logging=True,
        alternative_name_server_config={
            "target_name_servers": [
                {
                    "ipv4_address": "172.16.1.10",
                    "forwarding_path": "private",
                },
                {
                    "ipv4_address": "172.16.1.20",
                },
            ],
        },
        networks=[
            {
                "network_url": network_1.id,
            },
            {
                "network_url": network_2.id,
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/dns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewNetwork(ctx, "network-1", &compute.NetworkArgs{
    			Name:                  pulumi.String("network-1"),
    			AutoCreateSubnetworks: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewNetwork(ctx, "network-2", &compute.NetworkArgs{
    			Name:                  pulumi.String("network-2"),
    			AutoCreateSubnetworks: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dns.NewPolicy(ctx, "example-policy", &dns.PolicyArgs{
    			Name:                    pulumi.String("example-policy"),
    			EnableInboundForwarding: pulumi.Bool(true),
    			EnableLogging:           pulumi.Bool(true),
    			AlternativeNameServerConfig: &dns.PolicyAlternativeNameServerConfigArgs{
    				TargetNameServers: dns.PolicyAlternativeNameServerConfigTargetNameServerArray{
    					&dns.PolicyAlternativeNameServerConfigTargetNameServerArgs{
    						Ipv4Address:    pulumi.String("172.16.1.10"),
    						ForwardingPath: pulumi.String("private"),
    					},
    					&dns.PolicyAlternativeNameServerConfigTargetNameServerArgs{
    						Ipv4Address: pulumi.String("172.16.1.20"),
    					},
    				},
    			},
    			Networks: dns.PolicyNetworkArray{
    				&dns.PolicyNetworkArgs{
    					NetworkUrl: network_1.ID(),
    				},
    				&dns.PolicyNetworkArgs{
    					NetworkUrl: network_2.ID(),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var network_1 = new Gcp.Compute.Network("network-1", new()
        {
            Name = "network-1",
            AutoCreateSubnetworks = false,
        });
    
        var network_2 = new Gcp.Compute.Network("network-2", new()
        {
            Name = "network-2",
            AutoCreateSubnetworks = false,
        });
    
        var example_policy = new Gcp.Dns.Policy("example-policy", new()
        {
            Name = "example-policy",
            EnableInboundForwarding = true,
            EnableLogging = true,
            AlternativeNameServerConfig = new Gcp.Dns.Inputs.PolicyAlternativeNameServerConfigArgs
            {
                TargetNameServers = new[]
                {
                    new Gcp.Dns.Inputs.PolicyAlternativeNameServerConfigTargetNameServerArgs
                    {
                        Ipv4Address = "172.16.1.10",
                        ForwardingPath = "private",
                    },
                    new Gcp.Dns.Inputs.PolicyAlternativeNameServerConfigTargetNameServerArgs
                    {
                        Ipv4Address = "172.16.1.20",
                    },
                },
            },
            Networks = new[]
            {
                new Gcp.Dns.Inputs.PolicyNetworkArgs
                {
                    NetworkUrl = network_1.Id,
                },
                new Gcp.Dns.Inputs.PolicyNetworkArgs
                {
                    NetworkUrl = network_2.Id,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.Network;
    import com.pulumi.gcp.compute.NetworkArgs;
    import com.pulumi.gcp.dns.Policy;
    import com.pulumi.gcp.dns.PolicyArgs;
    import com.pulumi.gcp.dns.inputs.PolicyAlternativeNameServerConfigArgs;
    import com.pulumi.gcp.dns.inputs.PolicyNetworkArgs;
    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 network_1 = new Network("network-1", NetworkArgs.builder()
                .name("network-1")
                .autoCreateSubnetworks(false)
                .build());
    
            var network_2 = new Network("network-2", NetworkArgs.builder()
                .name("network-2")
                .autoCreateSubnetworks(false)
                .build());
    
            var example_policy = new Policy("example-policy", PolicyArgs.builder()
                .name("example-policy")
                .enableInboundForwarding(true)
                .enableLogging(true)
                .alternativeNameServerConfig(PolicyAlternativeNameServerConfigArgs.builder()
                    .targetNameServers(                
                        PolicyAlternativeNameServerConfigTargetNameServerArgs.builder()
                            .ipv4Address("172.16.1.10")
                            .forwardingPath("private")
                            .build(),
                        PolicyAlternativeNameServerConfigTargetNameServerArgs.builder()
                            .ipv4Address("172.16.1.20")
                            .build())
                    .build())
                .networks(            
                    PolicyNetworkArgs.builder()
                        .networkUrl(network_1.id())
                        .build(),
                    PolicyNetworkArgs.builder()
                        .networkUrl(network_2.id())
                        .build())
                .build());
    
        }
    }
    
    resources:
      example-policy:
        type: gcp:dns:Policy
        properties:
          name: example-policy
          enableInboundForwarding: true
          enableLogging: true
          alternativeNameServerConfig:
            targetNameServers:
              - ipv4Address: 172.16.1.10
                forwardingPath: private
              - ipv4Address: 172.16.1.20
          networks:
            - networkUrl: ${["network-1"].id}
            - networkUrl: ${["network-2"].id}
      network-1:
        type: gcp:compute:Network
        properties:
          name: network-1
          autoCreateSubnetworks: false
      network-2:
        type: gcp:compute:Network
        properties:
          name: network-2
          autoCreateSubnetworks: false
    

    Create Policy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Policy(name: string, args?: PolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Policy(resource_name: str,
               args: Optional[PolicyArgs] = None,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Policy(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               alternative_name_server_config: Optional[PolicyAlternativeNameServerConfigArgs] = None,
               description: Optional[str] = None,
               enable_inbound_forwarding: Optional[bool] = None,
               enable_logging: Optional[bool] = None,
               name: Optional[str] = None,
               networks: Optional[Sequence[PolicyNetworkArgs]] = None,
               project: Optional[str] = None)
    func NewPolicy(ctx *Context, name string, args *PolicyArgs, opts ...ResourceOption) (*Policy, error)
    public Policy(string name, PolicyArgs? args = null, CustomResourceOptions? opts = null)
    public Policy(String name, PolicyArgs args)
    public Policy(String name, PolicyArgs args, CustomResourceOptions options)
    
    type: gcp:dns:Policy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PolicyArgs
    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 PolicyArgs
    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 PolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var gcpPolicyResource = new Gcp.Dns.Policy("gcpPolicyResource", new()
    {
        AlternativeNameServerConfig = new Gcp.Dns.Inputs.PolicyAlternativeNameServerConfigArgs
        {
            TargetNameServers = new[]
            {
                new Gcp.Dns.Inputs.PolicyAlternativeNameServerConfigTargetNameServerArgs
                {
                    Ipv4Address = "string",
                    ForwardingPath = "string",
                },
            },
        },
        Description = "string",
        EnableInboundForwarding = false,
        EnableLogging = false,
        Name = "string",
        Networks = new[]
        {
            new Gcp.Dns.Inputs.PolicyNetworkArgs
            {
                NetworkUrl = "string",
            },
        },
        Project = "string",
    });
    
    example, err := dns.NewPolicy(ctx, "gcpPolicyResource", &dns.PolicyArgs{
    	AlternativeNameServerConfig: &dns.PolicyAlternativeNameServerConfigArgs{
    		TargetNameServers: dns.PolicyAlternativeNameServerConfigTargetNameServerArray{
    			&dns.PolicyAlternativeNameServerConfigTargetNameServerArgs{
    				Ipv4Address:    pulumi.String("string"),
    				ForwardingPath: pulumi.String("string"),
    			},
    		},
    	},
    	Description:             pulumi.String("string"),
    	EnableInboundForwarding: pulumi.Bool(false),
    	EnableLogging:           pulumi.Bool(false),
    	Name:                    pulumi.String("string"),
    	Networks: dns.PolicyNetworkArray{
    		&dns.PolicyNetworkArgs{
    			NetworkUrl: pulumi.String("string"),
    		},
    	},
    	Project: pulumi.String("string"),
    })
    
    var gcpPolicyResource = new Policy("gcpPolicyResource", PolicyArgs.builder()
        .alternativeNameServerConfig(PolicyAlternativeNameServerConfigArgs.builder()
            .targetNameServers(PolicyAlternativeNameServerConfigTargetNameServerArgs.builder()
                .ipv4Address("string")
                .forwardingPath("string")
                .build())
            .build())
        .description("string")
        .enableInboundForwarding(false)
        .enableLogging(false)
        .name("string")
        .networks(PolicyNetworkArgs.builder()
            .networkUrl("string")
            .build())
        .project("string")
        .build());
    
    gcp_policy_resource = gcp.dns.Policy("gcpPolicyResource",
        alternative_name_server_config={
            "targetNameServers": [{
                "ipv4Address": "string",
                "forwardingPath": "string",
            }],
        },
        description="string",
        enable_inbound_forwarding=False,
        enable_logging=False,
        name="string",
        networks=[{
            "networkUrl": "string",
        }],
        project="string")
    
    const gcpPolicyResource = new gcp.dns.Policy("gcpPolicyResource", {
        alternativeNameServerConfig: {
            targetNameServers: [{
                ipv4Address: "string",
                forwardingPath: "string",
            }],
        },
        description: "string",
        enableInboundForwarding: false,
        enableLogging: false,
        name: "string",
        networks: [{
            networkUrl: "string",
        }],
        project: "string",
    });
    
    type: gcp:dns:Policy
    properties:
        alternativeNameServerConfig:
            targetNameServers:
                - forwardingPath: string
                  ipv4Address: string
        description: string
        enableInboundForwarding: false
        enableLogging: false
        name: string
        networks:
            - networkUrl: string
        project: string
    

    Policy 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 Policy resource accepts the following input properties:

    AlternativeNameServerConfig PolicyAlternativeNameServerConfig
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    Description string
    A textual description field. Defaults to 'Managed by Pulumi'.
    EnableInboundForwarding bool
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    EnableLogging bool
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    Name string
    User assigned name for this policy.


    Networks List<PolicyNetwork>
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    AlternativeNameServerConfig PolicyAlternativeNameServerConfigArgs
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    Description string
    A textual description field. Defaults to 'Managed by Pulumi'.
    EnableInboundForwarding bool
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    EnableLogging bool
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    Name string
    User assigned name for this policy.


    Networks []PolicyNetworkArgs
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternativeNameServerConfig PolicyAlternativeNameServerConfig
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description String
    A textual description field. Defaults to 'Managed by Pulumi'.
    enableInboundForwarding Boolean
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enableLogging Boolean
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name String
    User assigned name for this policy.


    networks List<PolicyNetwork>
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternativeNameServerConfig PolicyAlternativeNameServerConfig
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description string
    A textual description field. Defaults to 'Managed by Pulumi'.
    enableInboundForwarding boolean
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enableLogging boolean
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name string
    User assigned name for this policy.


    networks PolicyNetwork[]
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternative_name_server_config PolicyAlternativeNameServerConfigArgs
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description str
    A textual description field. Defaults to 'Managed by Pulumi'.
    enable_inbound_forwarding bool
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enable_logging bool
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name str
    User assigned name for this policy.


    networks Sequence[PolicyNetworkArgs]
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternativeNameServerConfig Property Map
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description String
    A textual description field. Defaults to 'Managed by Pulumi'.
    enableInboundForwarding Boolean
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enableLogging Boolean
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name String
    User assigned name for this policy.


    networks List<Property Map>
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Policy 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 Policy Resource

    Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            alternative_name_server_config: Optional[PolicyAlternativeNameServerConfigArgs] = None,
            description: Optional[str] = None,
            enable_inbound_forwarding: Optional[bool] = None,
            enable_logging: Optional[bool] = None,
            name: Optional[str] = None,
            networks: Optional[Sequence[PolicyNetworkArgs]] = None,
            project: Optional[str] = None) -> Policy
    func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
    public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
    public static Policy get(String name, Output<String> id, PolicyState 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:
    AlternativeNameServerConfig PolicyAlternativeNameServerConfig
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    Description string
    A textual description field. Defaults to 'Managed by Pulumi'.
    EnableInboundForwarding bool
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    EnableLogging bool
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    Name string
    User assigned name for this policy.


    Networks List<PolicyNetwork>
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    AlternativeNameServerConfig PolicyAlternativeNameServerConfigArgs
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    Description string
    A textual description field. Defaults to 'Managed by Pulumi'.
    EnableInboundForwarding bool
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    EnableLogging bool
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    Name string
    User assigned name for this policy.


    Networks []PolicyNetworkArgs
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternativeNameServerConfig PolicyAlternativeNameServerConfig
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description String
    A textual description field. Defaults to 'Managed by Pulumi'.
    enableInboundForwarding Boolean
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enableLogging Boolean
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name String
    User assigned name for this policy.


    networks List<PolicyNetwork>
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternativeNameServerConfig PolicyAlternativeNameServerConfig
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description string
    A textual description field. Defaults to 'Managed by Pulumi'.
    enableInboundForwarding boolean
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enableLogging boolean
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name string
    User assigned name for this policy.


    networks PolicyNetwork[]
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternative_name_server_config PolicyAlternativeNameServerConfigArgs
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description str
    A textual description field. Defaults to 'Managed by Pulumi'.
    enable_inbound_forwarding bool
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enable_logging bool
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name str
    User assigned name for this policy.


    networks Sequence[PolicyNetworkArgs]
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    alternativeNameServerConfig Property Map
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    description String
    A textual description field. Defaults to 'Managed by Pulumi'.
    enableInboundForwarding Boolean
    Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address will be allocated from each of the sub-networks that are bound to this policy.
    enableLogging Boolean
    Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.
    name String
    User assigned name for this policy.


    networks List<Property Map>
    List of network names specifying networks to which this policy is applied. Structure is documented below.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Supporting Types

    PolicyAlternativeNameServerConfig, PolicyAlternativeNameServerConfigArgs

    TargetNameServers List<PolicyAlternativeNameServerConfigTargetNameServer>
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    TargetNameServers []PolicyAlternativeNameServerConfigTargetNameServer
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    targetNameServers List<PolicyAlternativeNameServerConfigTargetNameServer>
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    targetNameServers PolicyAlternativeNameServerConfigTargetNameServer[]
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    target_name_servers Sequence[PolicyAlternativeNameServerConfigTargetNameServer]
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.
    targetNameServers List<Property Map>
    Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. Structure is documented below.

    PolicyAlternativeNameServerConfigTargetNameServer, PolicyAlternativeNameServerConfigTargetNameServerArgs

    Ipv4Address string
    IPv4 address to forward to.
    ForwardingPath string
    Forwarding path for this TargetNameServer. If unset or default Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to private, Cloud DNS will always send queries through VPC for this target Possible values are: default, private.
    Ipv4Address string
    IPv4 address to forward to.
    ForwardingPath string
    Forwarding path for this TargetNameServer. If unset or default Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to private, Cloud DNS will always send queries through VPC for this target Possible values are: default, private.
    ipv4Address String
    IPv4 address to forward to.
    forwardingPath String
    Forwarding path for this TargetNameServer. If unset or default Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to private, Cloud DNS will always send queries through VPC for this target Possible values are: default, private.
    ipv4Address string
    IPv4 address to forward to.
    forwardingPath string
    Forwarding path for this TargetNameServer. If unset or default Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to private, Cloud DNS will always send queries through VPC for this target Possible values are: default, private.
    ipv4_address str
    IPv4 address to forward to.
    forwarding_path str
    Forwarding path for this TargetNameServer. If unset or default Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to private, Cloud DNS will always send queries through VPC for this target Possible values are: default, private.
    ipv4Address String
    IPv4 address to forward to.
    forwardingPath String
    Forwarding path for this TargetNameServer. If unset or default Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to private, Cloud DNS will always send queries through VPC for this target Possible values are: default, private.

    PolicyNetwork, PolicyNetworkArgs

    NetworkUrl string
    The id or fully qualified URL of the VPC network to forward queries to. This should be formatted like projects/{project}/global/networks/{network} or https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
    NetworkUrl string
    The id or fully qualified URL of the VPC network to forward queries to. This should be formatted like projects/{project}/global/networks/{network} or https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
    networkUrl String
    The id or fully qualified URL of the VPC network to forward queries to. This should be formatted like projects/{project}/global/networks/{network} or https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
    networkUrl string
    The id or fully qualified URL of the VPC network to forward queries to. This should be formatted like projects/{project}/global/networks/{network} or https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
    network_url str
    The id or fully qualified URL of the VPC network to forward queries to. This should be formatted like projects/{project}/global/networks/{network} or https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}
    networkUrl String
    The id or fully qualified URL of the VPC network to forward queries to. This should be formatted like projects/{project}/global/networks/{network} or https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}

    Import

    Policy can be imported using any of these accepted formats:

    • projects/{{project}}/policies/{{name}}

    • {{project}}/{{name}}

    • {{name}}

    When using the pulumi import command, Policy can be imported using one of the formats above. For example:

    $ pulumi import gcp:dns/policy:Policy default projects/{{project}}/policies/{{name}}
    
    $ pulumi import gcp:dns/policy:Policy default {{project}}/{{name}}
    
    $ pulumi import gcp:dns/policy:Policy default {{name}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi