@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
111 lines • 4.88 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.FirewallPolicyAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Allows associating hierarchical firewall policies with the target where they are applied. This allows creating policies and rules in a different location than they are applied.
* For more information on applying hierarchical firewall policies see the [official documentation](https://cloud.google.com/firewall/docs/firewall-policies#managing_hierarchical_firewall_policy_resources)
*
* To get more information about FirewallPolicyAssociation, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/firewallPolicies/addAssociation)
*
* ## Example Usage
*
* ### Firewall Policy Association
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const folder = new gcp.organizations.Folder("folder", {
* displayName: "my-folder",
* parent: "organizations/123456789",
* deletionProtection: false,
* });
* const policy = new gcp.compute.FirewallPolicy("policy", {
* parent: "organizations/123456789",
* shortName: "my-policy",
* description: "Example Resource",
* });
* const _default = new gcp.compute.FirewallPolicyAssociation("default", {
* firewallPolicy: policy.id,
* attachmentTarget: folder.name,
* name: "my-association",
* });
* ```
* ## Import
*
* FirewallPolicyAssociation can be imported using any of these accepted formats:
*
* * `locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}`
*
* * `{{firewall_policy}}/{{name}}`
*
* When using the `pulumi import` command, FirewallPolicyAssociation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default {{firewall_policy}}/{{name}}
* ```
*/
class FirewallPolicyAssociation extends pulumi.CustomResource {
/**
* Get an existing FirewallPolicyAssociation 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 FirewallPolicyAssociation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of FirewallPolicyAssociation. 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'] === FirewallPolicyAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["attachmentTarget"] = state?.attachmentTarget;
resourceInputs["firewallPolicy"] = state?.firewallPolicy;
resourceInputs["name"] = state?.name;
resourceInputs["shortName"] = state?.shortName;
}
else {
const args = argsOrState;
if (args?.attachmentTarget === undefined && !opts.urn) {
throw new Error("Missing required property 'attachmentTarget'");
}
if (args?.firewallPolicy === undefined && !opts.urn) {
throw new Error("Missing required property 'firewallPolicy'");
}
resourceInputs["attachmentTarget"] = args?.attachmentTarget;
resourceInputs["firewallPolicy"] = args?.firewallPolicy;
resourceInputs["name"] = args?.name;
resourceInputs["shortName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FirewallPolicyAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.FirewallPolicyAssociation = FirewallPolicyAssociation;
/** @internal */
FirewallPolicyAssociation.__pulumiType = 'gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation';
//# sourceMappingURL=firewallPolicyAssociation.js.map
;