@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
182 lines • 8.03 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.ProjectAccessPolicy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Represents an IAM v3 Access Policy parented by a Project. This policy defines rules
* that allow or deny access to resources within the specified project based on principals and conditions.
* See the Cloud IAM documentation for more details on Access Policies.
*
* > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
* See Provider Versions for more details on beta resources.
*
* To get more information about ProjectAccessPolicy, see:
*
* * [API documentation](https://cloud.google.com/iam/docs/reference/rest/v3beta/projects.locations.accessPolicies)
*
* ## Example Usage
*
* ### Access Policy Project Minimal
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumiverse/time";
*
* const project = new gcp.organizations.Project("project", {
* projectId: "ap-project-",
* name: "ap-project-",
* orgId: "123456789",
* billingAccount: "000000-0000000-0000000-000000",
* deletionPolicy: "DELETE",
* });
* const iamApi = new gcp.projects.Service("iam_api", {
* project: project.projectId,
* service: "iam.googleapis.com",
* disableOnDestroy: false,
* });
* const waitForProjectPropagation = new time.Sleep("wait_for_project_propagation", {createDuration: "30s"}, {
* dependsOn: [iamApi],
* });
* const testSa = new gcp.serviceaccount.Account("test_sa", {
* accountId: "svc-acc-",
* displayName: "Test Service Account for Access Policy",
* project: project.projectId,
* }, {
* dependsOn: [waitForProjectPropagation],
* });
* const example = new gcp.iam.ProjectAccessPolicy("example", {
* project: project.projectId,
* location: "global",
* accessPolicyId: "my-project-policy-",
* details: {
* rules: [{
* effect: "ALLOW",
* principals: [pulumi.interpolate`principal://iam.googleapis.com/projects/-/serviceAccounts/${testSa.email}`],
* operation: {
* permissions: ["eventarc.googleapis.com/messageBuses.publish"],
* },
* }],
* },
* }, {
* dependsOn: [
* waitForProjectPropagation,
* testSa,
* ],
* });
* ```
*
* ## Import
*
* ProjectAccessPolicy can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/accessPolicies/{{access_policy_id}}`
* * `{{project}}/{{location}}/{{access_policy_id}}`
* * `{{location}}/{{access_policy_id}}`
*
* When using the `pulumi import` command, ProjectAccessPolicy can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:iam/projectAccessPolicy:ProjectAccessPolicy default projects/{{project}}/locations/{{location}}/accessPolicies/{{access_policy_id}}
* $ pulumi import gcp:iam/projectAccessPolicy:ProjectAccessPolicy default {{project}}/{{location}}/{{access_policy_id}}
* $ pulumi import gcp:iam/projectAccessPolicy:ProjectAccessPolicy default {{location}}/{{access_policy_id}}
* ```
*/
class ProjectAccessPolicy extends pulumi.CustomResource {
/**
* Get an existing ProjectAccessPolicy 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 ProjectAccessPolicy(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:iam/projectAccessPolicy:ProjectAccessPolicy';
/**
* Returns true if the given object is an instance of ProjectAccessPolicy. 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'] === ProjectAccessPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessPolicyId"] = state?.accessPolicyId;
resourceInputs["annotations"] = state?.annotations;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["details"] = state?.details;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
resourceInputs["etag"] = state?.etag;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["uid"] = state?.uid;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.accessPolicyId === undefined && !opts.urn) {
throw new Error("Missing required property 'accessPolicyId'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["accessPolicyId"] = args?.accessPolicyId;
resourceInputs["annotations"] = args?.annotations;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["details"] = args?.details;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["location"] = args?.location;
resourceInputs["project"] = args?.project;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveAnnotations"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ProjectAccessPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.ProjectAccessPolicy = ProjectAccessPolicy;
//# sourceMappingURL=projectAccessPolicy.js.map