UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

339 lines • 12.7 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.RegionSecurityPolicyRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Region Security Policy Rule Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.RegionSecurityPolicy("default", { * region: "us-west2", * name: "policyruletest", * description: "basic region security policy", * type: "CLOUD_ARMOR", * }); * const policyRule = new gcp.compute.RegionSecurityPolicyRule("policy_rule", { * region: "us-west2", * securityPolicy: _default.name, * description: "new rule", * priority: 100, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: ["10.10.0.0/16"], * }, * }, * action: "allow", * preview: true, * }); * ``` * ### Region Security Policy Rule Multiple Rules * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.RegionSecurityPolicy("default", { * region: "us-west2", * name: "policywithmultiplerules", * description: "basic region security policy", * type: "CLOUD_ARMOR", * }); * const policyRuleOne = new gcp.compute.RegionSecurityPolicyRule("policy_rule_one", { * region: "us-west2", * securityPolicy: _default.name, * description: "new rule one", * priority: 100, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: ["10.10.0.0/16"], * }, * }, * action: "allow", * preview: true, * }); * const policyRuleTwo = new gcp.compute.RegionSecurityPolicyRule("policy_rule_two", { * region: "us-west2", * securityPolicy: _default.name, * description: "new rule two", * priority: 101, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: [ * "192.168.0.0/16", * "10.0.0.0/8", * ], * }, * }, * action: "allow", * preview: true, * }); * ``` * ### Region Security Policy Rule Default Rule * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.RegionSecurityPolicy("default", { * region: "us-west2", * name: "policywithdefaultrule", * description: "basic region security policy", * type: "CLOUD_ARMOR", * }); * const defaultRule = new gcp.compute.RegionSecurityPolicyRule("default_rule", { * region: "us-west2", * securityPolicy: _default.name, * description: "new rule", * action: "deny", * priority: 2147483647, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: ["*"], * }, * }, * }); * const policyRule = new gcp.compute.RegionSecurityPolicyRule("policy_rule", { * region: "us-west2", * securityPolicy: _default.name, * description: "new rule", * priority: 100, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: ["10.10.0.0/16"], * }, * }, * action: "allow", * preview: true, * }); * ``` * ### Region Security Policy Rule With Preconfigured Waf Config * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.RegionSecurityPolicy("default", { * region: "asia-southeast1", * name: "policyruletest", * description: "basic region security policy", * type: "CLOUD_ARMOR", * }); * const policyRule = new gcp.compute.RegionSecurityPolicyRule("policy_rule", { * region: "asia-southeast1", * securityPolicy: _default.name, * description: "new rule", * priority: 100, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: ["10.10.0.0/16"], * }, * }, * preconfiguredWafConfig: { * exclusions: [ * { * requestUris: [{ * operator: "STARTS_WITH", * value: "/admin", * }], * targetRuleSet: "rce-stable", * }, * { * requestQueryParams: [ * { * operator: "CONTAINS", * value: "password", * }, * { * operator: "STARTS_WITH", * value: "freeform", * }, * { * operator: "EQUALS", * value: "description", * }, * ], * targetRuleSet: "xss-stable", * targetRuleIds: [ * "owasp-crs-v030001-id941330-xss", * "owasp-crs-v030001-id941340-xss", * ], * }, * ], * }, * action: "allow", * preview: true, * }); * ``` * ### Region Security Policy Rule With Network Match * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * // First activate advanced network DDoS protection for the desired region * const policyddosprotection = new gcp.compute.RegionSecurityPolicy("policyddosprotection", { * region: "us-west2", * name: "policyddosprotection", * description: "policy for activating network DDoS protection for the desired region", * type: "CLOUD_ARMOR_NETWORK", * ddosProtectionConfig: { * ddosProtection: "ADVANCED_PREVIEW", * }, * }); * const edgeSecService = new gcp.compute.NetworkEdgeSecurityService("edge_sec_service", { * region: "us-west2", * name: "edgesecservice", * description: "linking policy to edge security service", * securityPolicy: policyddosprotection.selfLink, * }); * // Add the desired policy and custom rule. * const policynetworkmatch = new gcp.compute.RegionSecurityPolicy("policynetworkmatch", { * region: "us-west2", * name: "policyfornetworkmatch", * description: "region security policy for network match", * type: "CLOUD_ARMOR_NETWORK", * userDefinedFields: [{ * name: "SIG1_AT_0", * base: "TCP", * offset: 8, * size: 2, * mask: "0x8F00", * }], * }, { * dependsOn: [edgeSecService], * }); * const policyRuleNetworkMatch = new gcp.compute.RegionSecurityPolicyRule("policy_rule_network_match", { * region: "us-west2", * securityPolicy: policynetworkmatch.name, * description: "custom rule for network match", * priority: 100, * networkMatch: { * srcIpRanges: ["10.10.0.0/16"], * userDefinedFields: [{ * name: "SIG1_AT_0", * values: ["0x8F00"], * }], * }, * action: "allow", * preview: true, * }); * ``` * * ## Import * * RegionSecurityPolicyRule can be imported using any of these accepted formats: * * * `projects/{{project}}/regions/{{region}}/securityPolicies/{{security_policy}}/priority/{{priority}}` * * * `{{project}}/{{region}}/{{security_policy}}/{{priority}}` * * * `{{region}}/{{security_policy}}/{{priority}}` * * * `{{security_policy}}/{{priority}}` * * When using the `pulumi import` command, RegionSecurityPolicyRule can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default projects/{{project}}/regions/{{region}}/securityPolicies/{{security_policy}}/priority/{{priority}} * ``` * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default {{project}}/{{region}}/{{security_policy}}/{{priority}} * ``` * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default {{region}}/{{security_policy}}/{{priority}} * ``` * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule default {{security_policy}}/{{priority}} * ``` */ class RegionSecurityPolicyRule extends pulumi.CustomResource { /** * Get an existing RegionSecurityPolicyRule 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 RegionSecurityPolicyRule(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RegionSecurityPolicyRule. 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'] === RegionSecurityPolicyRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["action"] = state ? state.action : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["match"] = state ? state.match : undefined; resourceInputs["networkMatch"] = state ? state.networkMatch : undefined; resourceInputs["preconfiguredWafConfig"] = state ? state.preconfiguredWafConfig : undefined; resourceInputs["preview"] = state ? state.preview : undefined; resourceInputs["priority"] = state ? state.priority : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["rateLimitOptions"] = state ? state.rateLimitOptions : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["securityPolicy"] = state ? state.securityPolicy : undefined; } else { const args = argsOrState; if ((!args || args.action === undefined) && !opts.urn) { throw new Error("Missing required property 'action'"); } if ((!args || args.priority === undefined) && !opts.urn) { throw new Error("Missing required property 'priority'"); } if ((!args || args.region === undefined) && !opts.urn) { throw new Error("Missing required property 'region'"); } if ((!args || args.securityPolicy === undefined) && !opts.urn) { throw new Error("Missing required property 'securityPolicy'"); } resourceInputs["action"] = args ? args.action : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["match"] = args ? args.match : undefined; resourceInputs["networkMatch"] = args ? args.networkMatch : undefined; resourceInputs["preconfiguredWafConfig"] = args ? args.preconfiguredWafConfig : undefined; resourceInputs["preview"] = args ? args.preview : undefined; resourceInputs["priority"] = args ? args.priority : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["rateLimitOptions"] = args ? args.rateLimitOptions : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["securityPolicy"] = args ? args.securityPolicy : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RegionSecurityPolicyRule.__pulumiType, name, resourceInputs, opts); } } exports.RegionSecurityPolicyRule = RegionSecurityPolicyRule; /** @internal */ RegionSecurityPolicyRule.__pulumiType = 'gcp:compute/regionSecurityPolicyRule:RegionSecurityPolicyRule'; //# sourceMappingURL=regionSecurityPolicyRule.js.map