diff --git a/examples/examples_nodejs_test.go b/examples/examples_nodejs_test.go index 60b35ee7488..33237f8bed4 100644 --- a/examples/examples_nodejs_test.go +++ b/examples/examples_nodejs_test.go @@ -677,6 +677,8 @@ func TestRegress4011(t *testing.T) { }) // Disable envRegion mangling - test.Config = nil + test.Config = map[string]string{ + "parameterName": "regress-4011-" + randomString(10), + } integration.ProgramTest(t, &test) } diff --git a/examples/examples_test.go b/examples/examples_test.go index dd9c1b2f835..a0c10494cf7 100644 --- a/examples/examples_test.go +++ b/examples/examples_test.go @@ -5,6 +5,7 @@ package examples import ( "context" "io/ioutil" + "math/rand" "net/http" "os" "testing" @@ -92,6 +93,16 @@ func replay(t *testing.T, sequence string) { testutils.ReplaySequence(t, p, sequence) } +var letterRunes = []rune("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + +func randomString(length int) string { + b := make([]rune, length) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} + // This replicates the diff when running `pulumi preview` on a aws.rds.Instance with // pulumi-aws v6.0.0 and state from pulumi-aws 5.42.0. // diff --git a/examples/regress-4011/index.ts b/examples/regress-4011/index.ts index f84cdfc9bf0..d6079cf81b4 100644 --- a/examples/regress-4011/index.ts +++ b/examples/regress-4011/index.ts @@ -15,8 +15,11 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; +const cfg = new pulumi.Config(); +const parameterName = cfg.require("parameterName"); + const param = new aws.ssm.Parameter('regress-4011-test-secret', { - name: 'regress-4011-test-secret', + name: parameterName, type: 'SecureString', value: "test", }); diff --git a/examples/regress-4011/step1/index.ts b/examples/regress-4011/step1/index.ts index df167d20a2f..1ceb713d5e0 100644 --- a/examples/regress-4011/step1/index.ts +++ b/examples/regress-4011/step1/index.ts @@ -15,13 +15,16 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; +const cfg = new pulumi.Config(); +const parameterName = cfg.require("parameterName"); + const param = new aws.ssm.Parameter('regress-4011-test-secret', { - name: 'regress-4011-test-secret', + name: parameterName, type: 'SecureString', value: "test", }); -const retrievedParam = aws.ssm.Parameter.get('retrieved-parameter', 'regress-4011-test-secret:1'); +const retrievedParam = aws.ssm.Parameter.get('retrieved-parameter', `${parameterName}:1`); export const secret = pulumi.output(param).arn; export const retrievedSecret = pulumi.output(retrievedParam).arn;