@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
250 lines • 10.5 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkFirewallPolicyRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny).
*
* To get more information about NetworkFirewallPolicyRule, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/networkFirewallPolicies/addRule)
*
* ## Example Usage
*
* ### Network Firewall Policy Rule
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicGlobalNetworksecurityAddressGroup = new gcp.networksecurity.AddressGroup("basic_global_networksecurity_address_group", {
* name: "address-group",
* parent: "projects/my-project-name",
* description: "Sample global networksecurity_address_group",
* location: "global",
* items: ["208.80.154.224/32"],
* type: "IPV4",
* capacity: 100,
* });
* const basicNetworkFirewallPolicy = new gcp.compute.NetworkFirewallPolicy("basic_network_firewall_policy", {
* name: "fw-policy",
* description: "Sample global network firewall policy",
* project: "my-project-name",
* });
* const basicNetwork = new gcp.compute.Network("basic_network", {name: "network"});
* const basicKey = new gcp.tags.TagKey("basic_key", {
* description: "For keyname resources.",
* parent: "organizations/123456789",
* purpose: "GCE_FIREWALL",
* shortName: "tag-key",
* purposeData: {
* network: pulumi.interpolate`my-project-name/${basicNetwork.name}`,
* },
* });
* const basicValue = new gcp.tags.TagValue("basic_value", {
* description: "For valuename resources.",
* parent: basicKey.id,
* shortName: "tag-value",
* });
* const primary = new gcp.compute.NetworkFirewallPolicyRule("primary", {
* action: "allow",
* description: "This is a simple rule description",
* direction: "INGRESS",
* disabled: false,
* enableLogging: true,
* firewallPolicy: basicNetworkFirewallPolicy.name,
* priority: 1000,
* ruleName: "test-rule",
* targetServiceAccounts: ["my@service-account.com"],
* match: {
* srcAddressGroups: [basicGlobalNetworksecurityAddressGroup.id],
* srcIpRanges: ["10.100.0.1/32"],
* srcFqdns: ["google.com"],
* srcRegionCodes: ["US"],
* srcThreatIntelligences: ["iplist-known-malicious-ips"],
* srcSecureTags: [{
* name: basicValue.id,
* }],
* layer4Configs: [{
* ipProtocol: "all",
* }],
* },
* });
* ```
* ### Network Firewall Policy Rule Network Scope Egress
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicNetworkFirewallPolicy = new gcp.compute.NetworkFirewallPolicy("basic_network_firewall_policy", {
* name: "fw-policy",
* description: "Sample global network firewall policy",
* project: "my-project-name",
* });
* const primary = new gcp.compute.NetworkFirewallPolicyRule("primary", {
* action: "allow",
* description: "This is a simple rule description",
* direction: "EGRESS",
* disabled: false,
* enableLogging: true,
* firewallPolicy: basicNetworkFirewallPolicy.name,
* priority: 1000,
* ruleName: "test-rule",
* match: {
* destIpRanges: ["10.100.0.1/32"],
* destNetworkScope: "INTERNET",
* layer4Configs: [{
* ipProtocol: "all",
* }],
* },
* });
* ```
* ### Network Firewall Policy Rule Network Scope Ingress
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const basicNetworkFirewallPolicy = new gcp.compute.NetworkFirewallPolicy("basic_network_firewall_policy", {
* name: "fw-policy",
* description: "Sample global network firewall policy",
* project: "my-project-name",
* });
* const network = new gcp.compute.Network("network", {name: "network"});
* const primary = new gcp.compute.NetworkFirewallPolicyRule("primary", {
* action: "allow",
* description: "This is a simple rule description",
* direction: "INGRESS",
* disabled: false,
* enableLogging: true,
* firewallPolicy: basicNetworkFirewallPolicy.name,
* priority: 1000,
* ruleName: "test-rule",
* match: {
* srcIpRanges: ["11.100.0.1/32"],
* srcNetworkScope: "VPC_NETWORKS",
* srcNetworks: [network.id],
* layer4Configs: [{
* ipProtocol: "all",
* }],
* },
* });
* ```
*
* ## Import
*
* NetworkFirewallPolicyRule can be imported using any of these accepted formats:
*
* * `projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/rules/{{priority}}`
*
* * `{{project}}/{{firewall_policy}}/{{priority}}`
*
* * `{{firewall_policy}}/{{priority}}`
*
* When using the `pulumi import` command, NetworkFirewallPolicyRule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/networkFirewallPolicyRule:NetworkFirewallPolicyRule default projects/{{project}}/global/firewallPolicies/{{firewall_policy}}/rules/{{priority}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkFirewallPolicyRule:NetworkFirewallPolicyRule default {{project}}/{{firewall_policy}}/{{priority}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkFirewallPolicyRule:NetworkFirewallPolicyRule default {{firewall_policy}}/{{priority}}
* ```
*/
class NetworkFirewallPolicyRule extends pulumi.CustomResource {
/**
* Get an existing NetworkFirewallPolicyRule resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new NetworkFirewallPolicyRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NetworkFirewallPolicyRule. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === NetworkFirewallPolicyRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["description"] = state?.description;
resourceInputs["direction"] = state?.direction;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["enableLogging"] = state?.enableLogging;
resourceInputs["firewallPolicy"] = state?.firewallPolicy;
resourceInputs["kind"] = state?.kind;
resourceInputs["match"] = state?.match;
resourceInputs["priority"] = state?.priority;
resourceInputs["project"] = state?.project;
resourceInputs["ruleName"] = state?.ruleName;
resourceInputs["ruleTupleCount"] = state?.ruleTupleCount;
resourceInputs["securityProfileGroup"] = state?.securityProfileGroup;
resourceInputs["targetSecureTags"] = state?.targetSecureTags;
resourceInputs["targetServiceAccounts"] = state?.targetServiceAccounts;
resourceInputs["tlsInspect"] = state?.tlsInspect;
}
else {
const args = argsOrState;
if (args?.action === undefined && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if (args?.direction === undefined && !opts.urn) {
throw new Error("Missing required property 'direction'");
}
if (args?.firewallPolicy === undefined && !opts.urn) {
throw new Error("Missing required property 'firewallPolicy'");
}
if (args?.match === undefined && !opts.urn) {
throw new Error("Missing required property 'match'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
resourceInputs["action"] = args?.action;
resourceInputs["description"] = args?.description;
resourceInputs["direction"] = args?.direction;
resourceInputs["disabled"] = args?.disabled;
resourceInputs["enableLogging"] = args?.enableLogging;
resourceInputs["firewallPolicy"] = args?.firewallPolicy;
resourceInputs["match"] = args?.match;
resourceInputs["priority"] = args?.priority;
resourceInputs["project"] = args?.project;
resourceInputs["ruleName"] = args?.ruleName;
resourceInputs["securityProfileGroup"] = args?.securityProfileGroup;
resourceInputs["targetSecureTags"] = args?.targetSecureTags;
resourceInputs["targetServiceAccounts"] = args?.targetServiceAccounts;
resourceInputs["tlsInspect"] = args?.tlsInspect;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["kind"] = undefined /*out*/;
resourceInputs["ruleTupleCount"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkFirewallPolicyRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.NetworkFirewallPolicyRule = NetworkFirewallPolicyRule;
/** @internal */
NetworkFirewallPolicyRule.__pulumiType = 'gcp:compute/networkFirewallPolicyRule:NetworkFirewallPolicyRule';
//# sourceMappingURL=networkFirewallPolicyRule.js.map
;