UNPKG

@pulumi/gcp

Version:

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

177 lines 7.49 kB
"use strict"; // *** 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.Project = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Allows creation and management of a Google Cloud Platform project. * * Projects created with this resource must be associated with an Organization. * See the [Organization documentation](https://docs.cloud.google.com/resource-manager/docs/quickstarts) for more details. * * The user or service account that is running this provider when creating a `gcp.organizations.Project` * resource must have `roles/resourcemanager.projectCreator` on the specified organization. See the * [Access Control for Organizations Using IAM](https://docs.cloud.google.com/resource-manager/docs/access-control-org) * doc for more information. * * > This resource reads the specified billing account on every pulumi up and plan operation so you must have permissions on the specified billing account. * * > It is recommended to use the `constraints/compute.skipDefaultNetworkCreation` [constraint](https://www.terraform.io/docs/providers/google/r/google_organization_policy.html) to remove the default network instead of setting `autoCreateNetwork` to false, when possible. * * > It may take a while for the attached tag bindings to be deleted after the project is scheduled to be deleted. * * To get more information about projects, see: * * * [API documentation](https://docs.cloud.google.com/resource-manager/reference/rest/v1/projects) * * How-to Guides * * [Creating and managing projects](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myProject = new gcp.organizations.Project("my_project", { * name: "My Project", * projectId: "your-project-id", * orgId: "1234567", * }); * ``` * * To create a project under a specific folder * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const department1 = new gcp.organizations.Folder("department1", { * displayName: "Department 1", * parent: "organizations/1234567", * }); * const myProject_in_a_folder = new gcp.organizations.Project("my_project-in-a-folder", { * name: "My Project", * projectId: "your-project-id", * folderId: department1.name, * }); * ``` * * To create a project with a tag * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myProject = new gcp.organizations.Project("my_project", { * name: "My Project", * projectId: "your-project-id", * orgId: "1234567", * tags: { * "1234567/env": "staging", * }, * }); * ``` * * ## Import * * Projects can be imported using the `projectId`, e.g. * * * `{{project_id}}` * * When using the `pulumi import` command, Projects can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:organizations/project:Project default {{project_id}} * ``` */ class Project extends pulumi.CustomResource { /** * Get an existing Project 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 Project(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:organizations/project:Project'; /** * Returns true if the given object is an instance of Project. 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'] === Project.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["autoCreateNetwork"] = state?.autoCreateNetwork; resourceInputs["billingAccount"] = state?.billingAccount; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["folderId"] = state?.folderId; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["number"] = state?.number; resourceInputs["orgId"] = state?.orgId; resourceInputs["projectId"] = state?.projectId; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["tags"] = state?.tags; } else { const args = argsOrState; resourceInputs["autoCreateNetwork"] = args?.autoCreateNetwork; resourceInputs["billingAccount"] = args?.billingAccount; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["folderId"] = args?.folderId; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["orgId"] = args?.orgId; resourceInputs["projectId"] = args?.projectId; resourceInputs["tags"] = args?.tags; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["number"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Project.__pulumiType, name, resourceInputs, opts); } } exports.Project = Project; //# sourceMappingURL=project.js.map