Policy

class Policy : KotlinCustomResource

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

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>?

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

Link copied to clipboard

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>?

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

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

User assigned name for this policy.

Link copied to clipboard
val networks: Output<List<PolicyNetwork>>?

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

Link copied to clipboard
val project: Output<String>

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>