Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Provides access to Kubernetes Secret configuration for a given project, region and Composer Environment.
To get more information about Composer User Workloads Secrets, see:
- API documentation
- How-to Guides
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as std from "@pulumi/std";
const exampleEnvironment = new gcp.composer.Environment("example", {
name: "example-environment",
config: {
softwareConfig: {
imageVersion: "composer-3-airflow-2",
},
},
});
const exampleUserWorkloadsSecret = new gcp.composer.UserWorkloadsSecret("example", {
environment: exampleEnvironment.name,
name: "example-secret",
data: {
username: std.base64encode({
input: "username",
}).then(invoke => invoke.result),
password: std.base64encode({
input: "password",
}).then(invoke => invoke.result),
},
});
const example = exampleEnvironment.name.apply(name => gcp.composer.getUserWorkloadsSecretOutput({
environment: name,
name: googleComposerUserWorkloadsSecret.example.name,
}));
export const debug = example;
import pulumi
import pulumi_gcp as gcp
import pulumi_std as std
example_environment = gcp.composer.Environment("example",
name="example-environment",
config={
"software_config": {
"image_version": "composer-3-airflow-2",
},
})
example_user_workloads_secret = gcp.composer.UserWorkloadsSecret("example",
environment=example_environment.name,
name="example-secret",
data={
"username": std.base64encode(input="username").result,
"password": std.base64encode(input="password").result,
})
example = example_environment.name.apply(lambda name: gcp.composer.get_user_workloads_secret_output(environment=name,
name=google_composer_user_workloads_secret["example"]["name"]))
pulumi.export("debug", example)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/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 {
exampleEnvironment, err := composer.NewEnvironment(ctx, "example", &composer.EnvironmentArgs{
Name: pulumi.String("example-environment"),
Config: &composer.EnvironmentConfigArgs{
SoftwareConfig: &composer.EnvironmentConfigSoftwareConfigArgs{
ImageVersion: pulumi.String("composer-3-airflow-2"),
},
},
})
if err != nil {
return err
}
invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
Input: "username",
}, nil)
if err != nil {
return err
}
invokeBase64encode1, err := std.Base64encode(ctx, &std.Base64encodeArgs{
Input: "password",
}, nil)
if err != nil {
return err
}
_, err = composer.NewUserWorkloadsSecret(ctx, "example", &composer.UserWorkloadsSecretArgs{
Environment: exampleEnvironment.Name,
Name: pulumi.String("example-secret"),
Data: pulumi.StringMap{
"username": pulumi.String(invokeBase64encode.Result),
"password": pulumi.String(invokeBase64encode1.Result),
},
})
if err != nil {
return err
}
example := exampleEnvironment.Name.ApplyT(func(name string) (composer.GetUserWorkloadsSecretResult, error) {
return composer.GetUserWorkloadsSecretResult(interface{}(composer.LookupUserWorkloadsSecret(ctx, &composer.LookupUserWorkloadsSecretArgs{
Environment: name,
Name: googleComposerUserWorkloadsSecret.Example.Name,
}, nil))), nil
}).(composer.GetUserWorkloadsSecretResultOutput)
ctx.Export("debug", example)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var exampleEnvironment = new Gcp.Composer.Environment("example", new()
{
Name = "example-environment",
Config = new Gcp.Composer.Inputs.EnvironmentConfigArgs
{
SoftwareConfig = new Gcp.Composer.Inputs.EnvironmentConfigSoftwareConfigArgs
{
ImageVersion = "composer-3-airflow-2",
},
},
});
var exampleUserWorkloadsSecret = new Gcp.Composer.UserWorkloadsSecret("example", new()
{
Environment = exampleEnvironment.Name,
Name = "example-secret",
Data =
{
{ "username", Std.Base64encode.Invoke(new()
{
Input = "username",
}).Apply(invoke => invoke.Result) },
{ "password", Std.Base64encode.Invoke(new()
{
Input = "password",
}).Apply(invoke => invoke.Result) },
},
});
var example = Gcp.Composer.GetUserWorkloadsSecret.Invoke(new()
{
Environment = exampleEnvironment.Name,
Name = googleComposerUserWorkloadsSecret.Example.Name,
});
return new Dictionary<string, object?>
{
["debug"] = example,
};
});
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 com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.Base64encodeArgs;
import com.pulumi.gcp.composer.ComposerFunctions;
import com.pulumi.gcp.composer.inputs.GetUserWorkloadsSecretArgs;
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 exampleEnvironment = new Environment("exampleEnvironment", EnvironmentArgs.builder()
.name("example-environment")
.config(EnvironmentConfigArgs.builder()
.softwareConfig(EnvironmentConfigSoftwareConfigArgs.builder()
.imageVersion("composer-3-airflow-2")
.build())
.build())
.build());
var exampleUserWorkloadsSecret = new UserWorkloadsSecret("exampleUserWorkloadsSecret", UserWorkloadsSecretArgs.builder()
.environment(exampleEnvironment.name())
.name("example-secret")
.data(Map.ofEntries(
Map.entry("username", StdFunctions.base64encode(Base64encodeArgs.builder()
.input("username")
.build()).result()),
Map.entry("password", StdFunctions.base64encode(Base64encodeArgs.builder()
.input("password")
.build()).result())
))
.build());
final var example = exampleEnvironment.name().applyValue(_name -> ComposerFunctions.getUserWorkloadsSecret(GetUserWorkloadsSecretArgs.builder()
.environment(_name)
.name(googleComposerUserWorkloadsSecret.example().name())
.build()));
ctx.export("debug", example);
}
}
resources:
exampleEnvironment:
type: gcp:composer:Environment
name: example
properties:
name: example-environment
config:
softwareConfig:
imageVersion: composer-3-airflow-2
exampleUserWorkloadsSecret:
type: gcp:composer:UserWorkloadsSecret
name: example
properties:
environment: ${exampleEnvironment.name}
name: example-secret
data:
username:
fn::invoke:
function: std:base64encode
arguments:
input: username
return: result
password:
fn::invoke:
function: std:base64encode
arguments:
input: password
return: result
variables:
example:
fn::invoke:
function: gcp:composer:getUserWorkloadsSecret
arguments:
environment: ${exampleEnvironment.name}
name: ${googleComposerUserWorkloadsSecret.example.name}
outputs:
debug: ${example}
Using getUserWorkloadsSecret
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getUserWorkloadsSecret(args: GetUserWorkloadsSecretArgs, opts?: InvokeOptions): Promise<GetUserWorkloadsSecretResult>
function getUserWorkloadsSecretOutput(args: GetUserWorkloadsSecretOutputArgs, opts?: InvokeOptions): Output<GetUserWorkloadsSecretResult>def get_user_workloads_secret(environment: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
region: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetUserWorkloadsSecretResult
def get_user_workloads_secret_output(environment: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUserWorkloadsSecretResult]func LookupUserWorkloadsSecret(ctx *Context, args *LookupUserWorkloadsSecretArgs, opts ...InvokeOption) (*LookupUserWorkloadsSecretResult, error)
func LookupUserWorkloadsSecretOutput(ctx *Context, args *LookupUserWorkloadsSecretOutputArgs, opts ...InvokeOption) LookupUserWorkloadsSecretResultOutput> Note: This function is named LookupUserWorkloadsSecret in the Go SDK.
public static class GetUserWorkloadsSecret
{
public static Task<GetUserWorkloadsSecretResult> InvokeAsync(GetUserWorkloadsSecretArgs args, InvokeOptions? opts = null)
public static Output<GetUserWorkloadsSecretResult> Invoke(GetUserWorkloadsSecretInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetUserWorkloadsSecretResult> getUserWorkloadsSecret(GetUserWorkloadsSecretArgs args, InvokeOptions options)
public static Output<GetUserWorkloadsSecretResult> getUserWorkloadsSecret(GetUserWorkloadsSecretArgs args, InvokeOptions options)
fn::invoke:
function: gcp:composer/getUserWorkloadsSecret:getUserWorkloadsSecret
arguments:
# arguments dictionaryThe following arguments are supported:
- Environment string
- Environment where the Secret is stored.
- Name string
- Name of the 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 of the environment.
- Environment string
- Environment where the Secret is stored.
- Name string
- Name of the 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 of the environment.
- environment String
- Environment where the Secret is stored.
- name String
- Name of the 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 of the environment.
- environment string
- Environment where the Secret is stored.
- name string
- Name of the 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 of the environment.
- environment str
- Environment where the Secret is stored.
- name str
- Name of the 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 of the environment.
- environment String
- Environment where the Secret is stored.
- name String
- Name of the 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 of the environment.
getUserWorkloadsSecret Result
The following output properties are available:
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
