gcp.runtimeconfig.Variable
Explore with Pulumi AI
Example Usage
Example creating a RuntimeConfig variable.
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",
});
import pulumi
import pulumi_gcp as gcp
my_runtime_config = gcp.runtimeconfig.Config("my-runtime-config",
name="my-service-runtime-config",
description="Runtime configuration values for my service")
environment = gcp.runtimeconfig.Variable("environment",
parent=my_runtime_config.name,
name="prod-variables/hostname",
text="example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/runtimeconfig"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := runtimeconfig.NewConfig(ctx, "my-runtime-config", &runtimeconfig.ConfigArgs{
Name: pulumi.String("my-service-runtime-config"),
Description: pulumi.String("Runtime configuration values for my service"),
})
if err != nil {
return err
}
_, err = runtimeconfig.NewVariable(ctx, "environment", &runtimeconfig.VariableArgs{
Parent: my_runtime_config.Name,
Name: pulumi.String("prod-variables/hostname"),
Text: pulumi.String("example.com"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var my_runtime_config = new Gcp.RuntimeConfig.Config("my-runtime-config", new()
{
Name = "my-service-runtime-config",
Description = "Runtime configuration values for my service",
});
var environment = new Gcp.RuntimeConfig.Variable("environment", new()
{
Parent = my_runtime_config.Name,
Name = "prod-variables/hostname",
Text = "example.com",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.runtimeconfig.Config;
import com.pulumi.gcp.runtimeconfig.ConfigArgs;
import com.pulumi.gcp.runtimeconfig.Variable;
import com.pulumi.gcp.runtimeconfig.VariableArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var my_runtime_config = new Config("my-runtime-config", ConfigArgs.builder()
.name("my-service-runtime-config")
.description("Runtime configuration values for my service")
.build());
var environment = new Variable("environment", VariableArgs.builder()
.parent(my_runtime_config.name())
.name("prod-variables/hostname")
.text("example.com")
.build());
}
}
resources:
my-runtime-config:
type: gcp:runtimeconfig:Config
properties:
name: my-service-runtime-config
description: Runtime configuration values for my service
environment:
type: gcp:runtimeconfig:Variable
properties:
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.
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 pulumi
import pulumi_gcp as gcp
import pulumi_std as std
my_runtime_config = gcp.runtimeconfig.Config("my-runtime-config",
name="my-service-runtime-config",
description="Runtime configuration values for my service")
my_secret = gcp.runtimeconfig.Variable("my-secret",
parent=my_runtime_config.name,
name="secret",
value=std.filebase64(input="my-encrypted-secret.dat").result)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/runtimeconfig"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := runtimeconfig.NewConfig(ctx, "my-runtime-config", &runtimeconfig.ConfigArgs{
Name: pulumi.String("my-service-runtime-config"),
Description: pulumi.String("Runtime configuration values for my service"),
})
if err != nil {
return err
}
invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
Input: "my-encrypted-secret.dat",
}, nil)
if err != nil {
return err
}
_, err = runtimeconfig.NewVariable(ctx, "my-secret", &runtimeconfig.VariableArgs{
Parent: my_runtime_config.Name,
Name: pulumi.String("secret"),
Value: pulumi.String(invokeFilebase64.Result),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var my_runtime_config = new Gcp.RuntimeConfig.Config("my-runtime-config", new()
{
Name = "my-service-runtime-config",
Description = "Runtime configuration values for my service",
});
var my_secret = new Gcp.RuntimeConfig.Variable("my-secret", new()
{
Parent = my_runtime_config.Name,
Name = "secret",
Value = Std.Filebase64.Invoke(new()
{
Input = "my-encrypted-secret.dat",
}).Apply(invoke => invoke.Result),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.runtimeconfig.Config;
import com.pulumi.gcp.runtimeconfig.ConfigArgs;
import com.pulumi.gcp.runtimeconfig.Variable;
import com.pulumi.gcp.runtimeconfig.VariableArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var my_runtime_config = new Config("my-runtime-config", ConfigArgs.builder()
.name("my-service-runtime-config")
.description("Runtime configuration values for my service")
.build());
var my_secret = new Variable("my-secret", VariableArgs.builder()
.parent(my_runtime_config.name())
.name("secret")
.value(StdFunctions.filebase64(Filebase64Args.builder()
.input("my-encrypted-secret.dat")
.build()).result())
.build());
}
}
resources:
my-runtime-config:
type: gcp:runtimeconfig:Config
properties:
name: my-service-runtime-config
description: Runtime configuration values for my service
my-secret:
type: gcp:runtimeconfig:Variable
properties:
parent: ${["my-runtime-config"].name}
name: secret
value:
fn::invoke:
Function: std:filebase64
Arguments:
input: my-encrypted-secret.dat
Return: result
Create Variable Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Variable(name: string, args: VariableArgs, opts?: CustomResourceOptions);
@overload
def Variable(resource_name: str,
args: VariableArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Variable(resource_name: str,
opts: Optional[ResourceOptions] = None,
parent: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
text: Optional[str] = None,
value: Optional[str] = None)
func NewVariable(ctx *Context, name string, args VariableArgs, opts ...ResourceOption) (*Variable, error)
public Variable(string name, VariableArgs args, CustomResourceOptions? opts = null)
public Variable(String name, VariableArgs args)
public Variable(String name, VariableArgs args, CustomResourceOptions options)
type: gcp:runtimeconfig:Variable
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args VariableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args VariableArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VariableArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VariableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VariableArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var variableResource = new Gcp.RuntimeConfig.Variable("variableResource", new()
{
Parent = "string",
Name = "string",
Project = "string",
Text = "string",
Value = "string",
});
example, err := runtimeconfig.NewVariable(ctx, "variableResource", &runtimeconfig.VariableArgs{
Parent: pulumi.String("string"),
Name: pulumi.String("string"),
Project: pulumi.String("string"),
Text: pulumi.String("string"),
Value: pulumi.String("string"),
})
var variableResource = new Variable("variableResource", VariableArgs.builder()
.parent("string")
.name("string")
.project("string")
.text("string")
.value("string")
.build());
variable_resource = gcp.runtimeconfig.Variable("variableResource",
parent="string",
name="string",
project="string",
text="string",
value="string")
const variableResource = new gcp.runtimeconfig.Variable("variableResource", {
parent: "string",
name: "string",
project: "string",
text: "string",
value: "string",
});
type: gcp:runtimeconfig:Variable
properties:
name: string
parent: string
project: string
text: string
value: string
Variable Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Variable resource accepts the following input properties:
- Parent string
- The name of the RuntimeConfig resource containing this variable.
- Name string
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Text string
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - Value string
- Parent string
- The name of the RuntimeConfig resource containing this variable.
- Name string
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Text string
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - Value string
- parent String
- The name of the RuntimeConfig resource containing this variable.
- name String
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text String
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - value String
- parent string
- The name of the RuntimeConfig resource containing this variable.
- name string
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text string
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - value string
- parent str
- The name of the RuntimeConfig resource containing this variable.
- name str
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text str
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - value str
- parent String
- The name of the RuntimeConfig resource containing this variable.
- name String
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text String
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - value String
Outputs
All input properties are implicitly available as output properties. Additionally, the Variable resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Update
Time string - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- Id string
- The provider-assigned unique ID for this managed resource.
- Update
Time string - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- id String
- The provider-assigned unique ID for this managed resource.
- update
Time String - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- id string
- The provider-assigned unique ID for this managed resource.
- update
Time string - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- id str
- The provider-assigned unique ID for this managed resource.
- update_
time str - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- id String
- The provider-assigned unique ID for this managed resource.
- update
Time String - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
Look up Existing Variable Resource
Get an existing Variable resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VariableState, opts?: CustomResourceOptions): Variable
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
parent: Optional[str] = None,
project: Optional[str] = None,
text: Optional[str] = None,
update_time: Optional[str] = None,
value: Optional[str] = None) -> Variable
func GetVariable(ctx *Context, name string, id IDInput, state *VariableState, opts ...ResourceOption) (*Variable, error)
public static Variable Get(string name, Input<string> id, VariableState? state, CustomResourceOptions? opts = null)
public static Variable get(String name, Output<String> id, VariableState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Name string
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- Parent string
- The name of the RuntimeConfig resource containing this variable.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Text string
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - Update
Time string - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- Value string
- Name string
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- Parent string
- The name of the RuntimeConfig resource containing this variable.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Text string
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - Update
Time string - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- Value string
- name String
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- parent String
- The name of the RuntimeConfig resource containing this variable.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text String
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - update
Time String - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- value String
- name string
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- parent string
- The name of the RuntimeConfig resource containing this variable.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text string
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - update
Time string - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- value string
- name str
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- parent str
- The name of the RuntimeConfig resource containing this variable.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text str
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - update_
time str - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- value str
- name String
- The name of the variable to manage. Note that variable names can be hierarchical using slashes (e.g. "prod-variables/hostname").
- parent String
- The name of the RuntimeConfig resource containing this variable.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- text String
- or
value
- (Required) The content to associate with the variable. Exactly one oftext
orvariable
must be specified. Iftext
is specified, it must be a valid UTF-8 string and less than 4096 bytes in length. Ifvalue
is specified, it must be base64 encoded and less than 4096 bytes in length. - update
Time String - (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
- value String
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:
$ 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.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.