UNPKG

@pulumi/gcp

Version:

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

207 lines • 7.85 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.Config = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Config is a singleton resource used to configure the default Dataform settings for a specified location. * * > **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 Config, see: * * * [API documentation](https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations) * * How-to Guides * * [Official Documentation](https://cloud.google.com/dataform/docs/) * * ## Example Usage * * ### Dataform Config With Kms Key * * ```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", { * name: "project-1", * projectId: "project-1", * orgId: "123456789", * billingAccount: "000000-0000000-0000000-000000", * deletionPolicy: "DELETE", * }); * // Enable Cloud Key KMS API * const cloudkmsApi = new gcp.projects.Service("cloudkms_api", { * project: project.projectId, * service: "cloudkms.googleapis.com", * disableOnDestroy: false, * }); * // Enable Dataform API * const dataformApi = new gcp.projects.Service("dataform_api", { * project: project.projectId, * service: "dataform.googleapis.com", * disableOnDestroy: false, * }, { * dependsOn: [cloudkmsApi], * }); * // Add a sleep to wait for IAM propagation after API enablement * const waitForDataformApi = new time.Sleep("wait_for_dataform_api", {createDuration: "30s"}, { * dependsOn: [dataformApi], * }); * // Retrieve the Dataform service identity * const dataformSa = new gcp.projects.ServiceIdentity("dataform_sa", { * project: project.projectId, * service: "dataform.googleapis.com", * }, { * dependsOn: [waitForDataformApi], * }); * const keyring = new gcp.kms.KeyRing("keyring", { * project: project.projectId, * name: "example-key-ring", * location: "us-central1", * }, { * dependsOn: [waitForDataformApi], * }); * const exampleKey = new gcp.kms.CryptoKey("example_key", { * name: "example-crypto-key-name", * keyRing: keyring.id, * }); * // Grant the Encrypter/Decrypter role to the Dataform service agent on the KMS key * const cryptoKeyBinding = new gcp.kms.CryptoKeyIAMMember("crypto_key_binding", { * cryptoKeyId: exampleKey.id, * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * member: dataformSa.member, * }); * // Config with KMS key provided * const config = new gcp.dataform.Config("config", { * region: "us-central1", * defaultKmsKeyName: exampleKey.id, * project: project.projectId, * }, { * dependsOn: [cryptoKeyBinding], * }); * ``` * ### Dataform Config Without Kms Key * * ```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", { * name: "project-1", * projectId: "project-1", * orgId: "123456789", * billingAccount: "000000-0000000-0000000-000000", * deletionPolicy: "DELETE", * }); * // Enable Dataform API * const dataformApi = new gcp.projects.Service("dataform_api", { * project: project.projectId, * service: "dataform.googleapis.com", * disableOnDestroy: false, * }); * // Add a sleep to wait for IAM propagation after API enablement * const waitForDataformApi = new time.Sleep("wait_for_dataform_api", {createDuration: "30s"}, { * dependsOn: [dataformApi], * }); * // Config without KMS key provided * const config = new gcp.dataform.Config("config", { * region: "us-central1", * project: project.projectId, * }, { * dependsOn: [waitForDataformApi], * }); * ``` * * ## Import * * Config can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{region}}/config` * * `{{project}}/{{region}}` * * `{{region}}` * * When using the `pulumi import` command, Config can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:dataform/config:Config default projects/{{project}}/locations/{{region}}/config * $ pulumi import gcp:dataform/config:Config default {{project}}/{{region}} * $ pulumi import gcp:dataform/config:Config default {{region}} * ``` */ class Config extends pulumi.CustomResource { /** * Get an existing Config 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 Config(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:dataform/config:Config'; /** * Returns true if the given object is an instance of Config. 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'] === Config.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["defaultKmsKeyName"] = state?.defaultKmsKeyName; resourceInputs["project"] = state?.project; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.region === undefined && !opts.urn) { throw new Error("Missing required property 'region'"); } resourceInputs["defaultKmsKeyName"] = args?.defaultKmsKeyName; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Config.__pulumiType, name, resourceInputs, opts); } } exports.Config = Config; //# sourceMappingURL=config.js.map