UNPKG

@pulumi/gcp

Version:

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

155 lines 6.5 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.Variable = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Manages a RuntimeConfig variable in Google Cloud. For more information, see the * [official documentation](https://cloud.google.com/deployment-manager/runtime-configurator/), * or the * [JSON API](https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/). * * > **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. * * ## Example Usage * * Example creating a RuntimeConfig variable. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const my_runtime_config = new gcp.runtimeconfig.Config("my-runtime-config", { * name: "my-service-runtime-config", * description: "Runtime configuration values for my service", * }); * const environment = new gcp.runtimeconfig.Variable("environment", { * parent: my_runtime_config.name, * name: "prod-variables/hostname", * text: "example.com", * }); * ``` * * You can also encode binary content using the `value` argument instead. The * value must be base64 encoded. * * Example of using the `value` argument. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as std from "@pulumi/std"; * * const my_runtime_config = new gcp.runtimeconfig.Config("my-runtime-config", { * name: "my-service-runtime-config", * description: "Runtime configuration values for my service", * }); * const my_secret = new gcp.runtimeconfig.Variable("my-secret", { * parent: my_runtime_config.name, * name: "secret", * value: std.filebase64({ * input: "my-encrypted-secret.dat", * }).then(invoke => invoke.result), * }); * ``` * * ## Import * * Runtime Config Variables can be imported using the `name` or full variable name, e.g. * * * `projects/my-gcp-project/configs/{{config_id}}/variables/{{name}}` * * `{{config_id}}/{{name}}` * * When using the `pulumi import` command, Runtime Config Variables can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:runtimeconfig/variable:Variable default projects/my-gcp-project/configs/{{config_id}}/variables/{{name}} * $ pulumi import gcp:runtimeconfig/variable:Variable default {{config_id}}/{{name}} * ``` * When importing using only the name, the provider project must be set. */ class Variable extends pulumi.CustomResource { /** * Get an existing Variable 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 Variable(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:runtimeconfig/variable:Variable'; /** * Returns true if the given object is an instance of Variable. 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'] === Variable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["name"] = state?.name; resourceInputs["parent"] = state?.parent; resourceInputs["project"] = state?.project; resourceInputs["text"] = state?.text; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["value"] = state?.value; } else { const args = argsOrState; if (args?.parent === undefined && !opts.urn) { throw new Error("Missing required property 'parent'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["name"] = args?.name; resourceInputs["parent"] = args?.parent; resourceInputs["project"] = args?.project; resourceInputs["text"] = args?.text ? pulumi.secret(args.text) : undefined; resourceInputs["value"] = args?.value ? pulumi.secret(args.value) : undefined; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["text", "value"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Variable.__pulumiType, name, resourceInputs, opts); } } exports.Variable = Variable; //# sourceMappingURL=variable.js.map