PolicyArgs

data class PolicyArgs(val alternativeNameServerConfig: Output<PolicyAlternativeNameServerConfigArgs>? = null, val description: Output<String>? = null, val enableInboundForwarding: Output<Boolean>? = null, val enableLogging: Output<Boolean>? = null, val name: Output<String>? = null, val networks: Output<List<PolicyNetworkArgs>>? = null, val project: Output<String>? = null) : ConvertibleToJava<PolicyArgs>

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

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()
.autoCreateSubnetworks(false)
.build());
var network_2 = new Network("network-2", NetworkArgs.builder()
.autoCreateSubnetworks(false)
.build());
var example_policy = new Policy("example-policy", PolicyArgs.builder()
.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());
}
}

Import

Policy can be imported using any of these accepted formats

$ 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}}

Constructors

Link copied to clipboard
constructor(alternativeNameServerConfig: Output<PolicyAlternativeNameServerConfigArgs>? = null, description: Output<String>? = null, enableInboundForwarding: Output<Boolean>? = null, enableLogging: Output<Boolean>? = null, name: Output<String>? = null, networks: Output<List<PolicyNetworkArgs>>? = null, project: Output<String>? = null)

Properties

Link copied to clipboard

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.

Link copied to clipboard
val description: Output<String>? = null

A textual description field. Defaults to 'Managed by Pulumi'.

Link copied to clipboard
val enableInboundForwarding: Output<Boolean>? = null

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.

Link copied to clipboard
val enableLogging: Output<Boolean>? = null

Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set.

Link copied to clipboard
val name: Output<String>? = null

User assigned name for this policy.

Link copied to clipboard
val networks: Output<List<PolicyNetworkArgs>>? = null

List of network names specifying networks to which this policy is applied. Structure is documented below.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Functions

Link copied to clipboard
open override fun toJava(): PolicyArgs