@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
127 lines • 5.18 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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");
/**
* ## 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, Object.assign(Object.assign({}, 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 ? state.name : undefined;
resourceInputs["parent"] = state ? state.parent : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["text"] = state ? state.text : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
resourceInputs["value"] = state ? state.value : undefined;
}
else {
const args = argsOrState;
if ((!args || args.parent === undefined) && !opts.urn) {
throw new Error("Missing required property 'parent'");
}
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["parent"] = args ? args.parent : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["text"] = (args === null || args === void 0 ? void 0 : args.text) ? pulumi.secret(args.text) : undefined;
resourceInputs["value"] = (args === null || args === void 0 ? void 0 : 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