gcp.composer.UserWorkloadsSecret
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as std from "@pulumi/std";
const example = new gcp.composer.Environment("example", {
name: "example-environment",
project: "example-project",
region: "us-central1",
config: {
softwareConfig: {
imageVersion: "example-image-version",
},
},
});
const exampleUserWorkloadsSecret = new gcp.composer.UserWorkloadsSecret("example", {
name: "example-secret",
project: "example-project",
region: "us-central1",
environment: example.name,
data: {
email: std.base64encode({
input: "example-email",
}).then(invoke => invoke.result),
password: std.base64encode({
input: "example-password",
}).then(invoke => invoke.result),
},
});
import pulumi
import pulumi_gcp as gcp
import pulumi_std as std
example = gcp.composer.Environment("example",
name="example-environment",
project="example-project",
region="us-central1",
config={
"software_config": {
"image_version": "example-image-version",
},
})
example_user_workloads_secret = gcp.composer.UserWorkloadsSecret("example",
name="example-secret",
project="example-project",
region="us-central1",
environment=example.name,
data={
"email": std.base64encode(input="example-email").result,
"password": std.base64encode(input="example-password").result,
})
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/composer"
"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 {
example, err := composer.NewEnvironment(ctx, "example", &composer.EnvironmentArgs{
Name: pulumi.String("example-environment"),
Project: pulumi.String("example-project"),
Region: pulumi.String("us-central1"),
Config: &composer.EnvironmentConfigArgs{
SoftwareConfig: &composer.EnvironmentConfigSoftwareConfigArgs{
ImageVersion: pulumi.String("example-image-version"),
},
},
})
if err != nil {
return err
}
invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
Input: "example-email",
}, nil)
if err != nil {
return err
}
invokeBase64encode1, err := std.Base64encode(ctx, &std.Base64encodeArgs{
Input: "example-password",
}, nil)
if err != nil {
return err
}
_, err = composer.NewUserWorkloadsSecret(ctx, "example", &composer.UserWorkloadsSecretArgs{
Name: pulumi.String("example-secret"),
Project: pulumi.String("example-project"),
Region: pulumi.String("us-central1"),
Environment: example.Name,
Data: pulumi.StringMap{
"email": pulumi.String(invokeBase64encode.Result),
"password": pulumi.String(invokeBase64encode1.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 example = new Gcp.Composer.Environment("example", new()
{
Name = "example-environment",
Project = "example-project",
Region = "us-central1",
Config = new Gcp.Composer.Inputs.EnvironmentConfigArgs
{
SoftwareConfig = new Gcp.Composer.Inputs.EnvironmentConfigSoftwareConfigArgs
{
ImageVersion = "example-image-version",
},
},
});
var exampleUserWorkloadsSecret = new Gcp.Composer.UserWorkloadsSecret("example", new()
{
Name = "example-secret",
Project = "example-project",
Region = "us-central1",
Environment = example.Name,
Data =
{
{ "email", Std.Base64encode.Invoke(new()
{
Input = "example-email",
}).Apply(invoke => invoke.Result) },
{ "password", Std.Base64encode.Invoke(new()
{
Input = "example-password",
}).Apply(invoke => invoke.Result) },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.composer.Environment;
import com.pulumi.gcp.composer.EnvironmentArgs;
import com.pulumi.gcp.composer.inputs.EnvironmentConfigArgs;
import com.pulumi.gcp.composer.inputs.EnvironmentConfigSoftwareConfigArgs;
import com.pulumi.gcp.composer.UserWorkloadsSecret;
import com.pulumi.gcp.composer.UserWorkloadsSecretArgs;
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 example = new Environment("example", EnvironmentArgs.builder()
.name("example-environment")
.project("example-project")
.region("us-central1")
.config(EnvironmentConfigArgs.builder()
.softwareConfig(EnvironmentConfigSoftwareConfigArgs.builder()
.imageVersion("example-image-version")
.build())
.build())
.build());
var exampleUserWorkloadsSecret = new UserWorkloadsSecret("exampleUserWorkloadsSecret", UserWorkloadsSecretArgs.builder()
.name("example-secret")
.project("example-project")
.region("us-central1")
.environment(example.name())
.data(Map.ofEntries(
Map.entry("email", StdFunctions.base64encode(Base64encodeArgs.builder()
.input("example-email")
.build()).result()),
Map.entry("password", StdFunctions.base64encode(Base64encodeArgs.builder()
.input("example-password")
.build()).result())
))
.build());
}
}
resources:
example:
type: gcp:composer:Environment
properties:
name: example-environment
project: example-project
region: us-central1
config:
softwareConfig:
imageVersion: example-image-version
exampleUserWorkloadsSecret:
type: gcp:composer:UserWorkloadsSecret
name: example
properties:
name: example-secret
project: example-project
region: us-central1
environment: ${example.name}
data:
email:
fn::invoke:
Function: std:base64encode
Arguments:
input: example-email
Return: result
password:
fn::invoke:
Function: std:base64encode
Arguments:
input: example-password
Return: result
Create UserWorkloadsSecret Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new UserWorkloadsSecret(name: string, args: UserWorkloadsSecretArgs, opts?: CustomResourceOptions);
@overload
def UserWorkloadsSecret(resource_name: str,
args: UserWorkloadsSecretArgs,
opts: Optional[ResourceOptions] = None)
@overload
def UserWorkloadsSecret(resource_name: str,
opts: Optional[ResourceOptions] = None,
environment: Optional[str] = None,
data: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
project: Optional[str] = None,
region: Optional[str] = None)
func NewUserWorkloadsSecret(ctx *Context, name string, args UserWorkloadsSecretArgs, opts ...ResourceOption) (*UserWorkloadsSecret, error)
public UserWorkloadsSecret(string name, UserWorkloadsSecretArgs args, CustomResourceOptions? opts = null)
public UserWorkloadsSecret(String name, UserWorkloadsSecretArgs args)
public UserWorkloadsSecret(String name, UserWorkloadsSecretArgs args, CustomResourceOptions options)
type: gcp:composer:UserWorkloadsSecret
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 UserWorkloadsSecretArgs
- 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 UserWorkloadsSecretArgs
- 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 UserWorkloadsSecretArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserWorkloadsSecretArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserWorkloadsSecretArgs
- 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 userWorkloadsSecretResource = new Gcp.Composer.UserWorkloadsSecret("userWorkloadsSecretResource", new()
{
Environment = "string",
Data =
{
{ "string", "string" },
},
Name = "string",
Project = "string",
Region = "string",
});
example, err := composer.NewUserWorkloadsSecret(ctx, "userWorkloadsSecretResource", &composer.UserWorkloadsSecretArgs{
Environment: pulumi.String("string"),
Data: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
Project: pulumi.String("string"),
Region: pulumi.String("string"),
})
var userWorkloadsSecretResource = new UserWorkloadsSecret("userWorkloadsSecretResource", UserWorkloadsSecretArgs.builder()
.environment("string")
.data(Map.of("string", "string"))
.name("string")
.project("string")
.region("string")
.build());
user_workloads_secret_resource = gcp.composer.UserWorkloadsSecret("userWorkloadsSecretResource",
environment="string",
data={
"string": "string",
},
name="string",
project="string",
region="string")
const userWorkloadsSecretResource = new gcp.composer.UserWorkloadsSecret("userWorkloadsSecretResource", {
environment: "string",
data: {
string: "string",
},
name: "string",
project: "string",
region: "string",
});
type: gcp:composer:UserWorkloadsSecret
properties:
data:
string: string
environment: string
name: string
project: string
region: string
UserWorkloadsSecret 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 UserWorkloadsSecret resource accepts the following input properties:
- Environment string
- Environment where the Kubernetes Secret will be stored and used.
- Data Dictionary<string, string>
- A map of the secret data.
- Name string
- Name of the Kubernetes Secret.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- The location or Compute Engine region for the environment.
- Environment string
- Environment where the Kubernetes Secret will be stored and used.
- Data map[string]string
- A map of the secret data.
- Name string
- Name of the Kubernetes Secret.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- The location or Compute Engine region for the environment.
- environment String
- Environment where the Kubernetes Secret will be stored and used.
- data Map<String,String>
- A map of the secret data.
- name String
- Name of the Kubernetes Secret.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- The location or Compute Engine region for the environment.
- environment string
- Environment where the Kubernetes Secret will be stored and used.
- data {[key: string]: string}
- A map of the secret data.
- name string
- Name of the Kubernetes Secret.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region string
- The location or Compute Engine region for the environment.
- environment str
- Environment where the Kubernetes Secret will be stored and used.
- data Mapping[str, str]
- A map of the secret data.
- name str
- Name of the Kubernetes Secret.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region str
- The location or Compute Engine region for the environment.
- environment String
- Environment where the Kubernetes Secret will be stored and used.
- data Map<String>
- A map of the secret data.
- name String
- Name of the Kubernetes Secret.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- The location or Compute Engine region for the environment.
Outputs
All input properties are implicitly available as output properties. Additionally, the UserWorkloadsSecret resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing UserWorkloadsSecret Resource
Get an existing UserWorkloadsSecret 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?: UserWorkloadsSecretState, opts?: CustomResourceOptions): UserWorkloadsSecret
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
data: Optional[Mapping[str, str]] = None,
environment: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
region: Optional[str] = None) -> UserWorkloadsSecret
func GetUserWorkloadsSecret(ctx *Context, name string, id IDInput, state *UserWorkloadsSecretState, opts ...ResourceOption) (*UserWorkloadsSecret, error)
public static UserWorkloadsSecret Get(string name, Input<string> id, UserWorkloadsSecretState? state, CustomResourceOptions? opts = null)
public static UserWorkloadsSecret get(String name, Output<String> id, UserWorkloadsSecretState 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.
- Data Dictionary<string, string>
- A map of the secret data.
- Environment string
- Environment where the Kubernetes Secret will be stored and used.
- Name string
- Name of the Kubernetes Secret.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- The location or Compute Engine region for the environment.
- Data map[string]string
- A map of the secret data.
- Environment string
- Environment where the Kubernetes Secret will be stored and used.
- Name string
- Name of the Kubernetes Secret.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- The location or Compute Engine region for the environment.
- data Map<String,String>
- A map of the secret data.
- environment String
- Environment where the Kubernetes Secret will be stored and used.
- name String
- Name of the Kubernetes Secret.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- The location or Compute Engine region for the environment.
- data {[key: string]: string}
- A map of the secret data.
- environment string
- Environment where the Kubernetes Secret will be stored and used.
- name string
- Name of the Kubernetes Secret.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region string
- The location or Compute Engine region for the environment.
- data Mapping[str, str]
- A map of the secret data.
- environment str
- Environment where the Kubernetes Secret will be stored and used.
- name str
- Name of the Kubernetes Secret.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region str
- The location or Compute Engine region for the environment.
- data Map<String>
- A map of the secret data.
- environment String
- Environment where the Kubernetes Secret will be stored and used.
- name String
- Name of the Kubernetes Secret.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- The location or Compute Engine region for the environment.
Import
Secret can be imported using any of these accepted formats:
projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsSecrets/{{name}}
{{project}}/{{region}}/{{environment}}/{{name}}
{{environment}}/{{name}}
When using the pulumi import
command, Environment can be imported using one of the formats above. For example:
$ pulumi import gcp:composer/userWorkloadsSecret:UserWorkloadsSecret example projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsSecrets/{{name}}
$ pulumi import gcp:composer/userWorkloadsSecret:UserWorkloadsSecret example {{project}}/{{region}}/{{environment}}/{{name}}
$ pulumi import gcp:composer/userWorkloadsSecret:UserWorkloadsSecret example {{environment}}/{{name}}
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.