@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
132 lines • 5.15 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.Variable = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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/).
*
* ## 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}}
* ```
*
* ```sh
* $ 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 });
}
/**
* 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["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["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;
/** @internal */
Variable.__pulumiType = 'gcp:runtimeconfig/variable:Variable';
//# sourceMappingURL=variable.js.map
;