This example is not minimal. Apologies - I'm in a time crunch as I write this.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as random from "@pulumi/random";
import * as pcloud from "@pulumi/pulumiservice";
const config = new pulumi.Config();
const gitHubToken = config.requireSecret("githubToken");
const secret = new aws.secretsmanager.Secret("github-token", {
description: "GitHub token for ESC.",
recoveryWindowInDays: 0
});
new aws.secretsmanager.SecretVersion("github-token", {
secretId: secret.id,
secretString: gitHubToken
});
const envYaml = secret.name.apply(name => `
imports:
- aws/aws-oidc-admin
values:
aws:
secrets:
fn::open::aws-secrets:
region: us-west-2
login: \${aws.login}
get:
github-token:
secretId: ${name}
pulumiConfig:
githubToken: \${aws.secrets.github-token-name}
`);
// NOTE: This can be removed once environments have autonaming:
const suffix = new random.RandomString("env-name-suffix", {
length: 6
});
const org = pulumi.getOrganization();
const env = new pcloud.Environment("aws-secrets", {
organization: org,
project: "foundational-training",
name: pulumi.interpolate`aws-secrets-${suffix.result}`,
yaml: envYaml.apply(yaml => new pulumi.asset.StringAsset(yaml))
});
export const envName = env.name;
Output of pulumi about
CLI
Version 3.135.1
Go Version go1.23.2
Go Compiler gc
Plugins
KIND NAME VERSION
resource aws 6.54.2
language nodejs 3.135.1-dev.0
resource pulumiservice 0.26.2
resource random 4.16.6
Host
OS darwin
Version 14.6.1
Arch arm64
This project is written in nodejs: executable='/opt/homebrew/bin/node' version='v22.5.1'
Current Stack: jkodrofftest/esc-ex-02-aws-secrets-setup/dev
TYPE URN
pulumi:pulumi:Stack urn:pulumi:dev::esc-ex-02-aws-secrets-setup::pulumi:pulumi:Stack::esc-ex-02-aws-secrets-setup-dev
pulumi:providers:aws urn:pulumi:dev::esc-ex-02-aws-secrets-setup::pulumi:providers:aws::default_6_54_2
aws:secretsmanager/secret:Secret urn:pulumi:dev::esc-ex-02-aws-secrets-setup::aws:secretsmanager/secret:Secret::github-token
aws:secretsmanager/secretVersion:SecretVersion urn:pulumi:dev::esc-ex-02-aws-secrets-setup::aws:secretsmanager/secretVersion:SecretVersion::github-token
Found no pending operations associated with dev
Backend
Name pulumi.com
URL https://app.pulumi.com/josh-pulumi-corp
User josh-pulumi-corp
Organizations josh-pulumi-corp, jkodrofftest, aws-partnership, zephyr, jkodroff-team, pulumi
Token type personal
Dependencies:
NAME VERSION
@pulumi/pulumi 3.135.1
@pulumi/pulumiservice 0.26.2
@pulumi/random 4.16.6
@types/node 18.19.54
typescript 5.6.2
@pulumi/aws 6.54.2
Pulumi locates its logs in /var/folders/5m/4n1x3f8151s35wc80w06z5k80000gn/T/ by default
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
What happened?
Creating an environment with a (possibly invalid) way of creating a string asset throws a panic:
Example
This example is not minimal. Apologies - I'm in a time crunch as I write this.
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).