@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
166 lines • 7.17 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrganizationSecurityPolicyAssociation = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* An association for the OrganizationSecurityPolicy.
*
* To get more information about OrganizationSecurityPolicyAssociation, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/organizationSecurityPolicies/addAssociation)
* * How-to Guides
* * [Associating a policy with the organization or folder](https://cloud.google.com/vpc/docs/using-firewall-policies#associate)
*
* ## Example Usage
*
* ### Organization Security Policy Association Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const securityPolicyTarget = new gcp.organizations.Folder("security_policy_target", {
* displayName: "tf-test-secpol",
* parent: "organizations/123456789",
* deletionProtection: false,
* });
* const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
* displayName: "tf-test",
* parent: securityPolicyTarget.name,
* type: "CLOUD_ARMOR",
* });
* const policyOrganizationSecurityPolicyAssociation = new gcp.compute.OrganizationSecurityPolicyAssociation("policy", {
* name: "tf-test",
* attachmentId: policy.parent,
* policyId: policy.id,
* });
* ```
* ### Organization Security Policy Association Excluded
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const securityPolicyTarget = new gcp.organizations.Folder("security_policy_target", {
* displayName: "tf-test-secpol-_72490",
* parent: "organizations/123456789",
* deletionProtection: false,
* });
* const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
* shortName: "tf-test_89605",
* parent: securityPolicyTarget.name,
* type: "CLOUD_ARMOR",
* });
* const policyOrganizationSecurityPolicyAssociation = new gcp.compute.OrganizationSecurityPolicyAssociation("policy", {
* name: "tf-test",
* attachmentId: "organizations/123456789",
* policyId: policy.id,
* excludedProjects: [
* "projects/2000000002",
* "projects/3000000003",
* ],
* excludedFolders: [
* "folders/4000000004",
* "folders/5000000005",
* ],
* });
* ```
*
* ## Import
*
* OrganizationSecurityPolicyAssociation can be imported using any of these accepted formats:
*
* * `{{policy_id}}/association/{{name}}`
*
* When using the `pulumi import` command, OrganizationSecurityPolicyAssociation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation default {{policy_id}}/association/{{name}}
* ```
*/
class OrganizationSecurityPolicyAssociation extends pulumi.CustomResource {
/**
* Get an existing OrganizationSecurityPolicyAssociation 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 OrganizationSecurityPolicyAssociation(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation';
/**
* Returns true if the given object is an instance of OrganizationSecurityPolicyAssociation. 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'] === OrganizationSecurityPolicyAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["attachmentId"] = state?.attachmentId;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["excludedFolders"] = state?.excludedFolders;
resourceInputs["excludedProjects"] = state?.excludedProjects;
resourceInputs["name"] = state?.name;
resourceInputs["policyId"] = state?.policyId;
}
else {
const args = argsOrState;
if (args?.attachmentId === undefined && !opts.urn) {
throw new Error("Missing required property 'attachmentId'");
}
if (args?.policyId === undefined && !opts.urn) {
throw new Error("Missing required property 'policyId'");
}
resourceInputs["attachmentId"] = args?.attachmentId;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["excludedFolders"] = args?.excludedFolders;
resourceInputs["excludedProjects"] = args?.excludedProjects;
resourceInputs["name"] = args?.name;
resourceInputs["policyId"] = args?.policyId;
resourceInputs["displayName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OrganizationSecurityPolicyAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.OrganizationSecurityPolicyAssociation = OrganizationSecurityPolicyAssociation;
//# sourceMappingURL=organizationSecurityPolicyAssociation.js.map