docs icon indicating copy to clipboard operation
docs copied to clipboard

Improvement for https://www.pulumi.com/learn/building-with-pulumi/stack-references/

Open eguerlain opened this issue 2 years ago • 1 comments

When creating reference to the stack of my_first_app, the stackRef variable is built with a kebab-cased project name (my-first-app):

const stackRef = new pulumi.StackReference(`${org}/my-first-app/${stack}`)

However, this project was created with a snake_cased name in Creating a Pulumi Project. (mkdir my_first_app)

This leads to the following error when running pulumi up for the my-second-app-staging stack:

     Type                             Name                            Plan       Info
 +   pulumi:pulumi:Stack              my-second-app-staging           create     1 error
     └─ pulumi:pulumi:StackReference  etigrln95/my-first-app/staging             1 error

Diagnostics:
  pulumi:pulumi:Stack (my-second-app-staging):
    error: preview failed

  pulumi:pulumi:StackReference (etigrln95/my-first-app/staging):
    error: Preview failed: unknown stack "etigrln95/my-first-app/staging"

Using snake_cased project name works correctly:

const stackRef = new pulumi.StackReference(`${org}/my_first_app/${stack}`)

I suggest using kebab-cased name when creating the my-first-app directory in the first tutorial to keep a consistant naming.

eguerlain avatar Nov 05 '23 10:11 eguerlain

Thank you @eguerlain for submitting this issue! We will be taking a look into this. We do have an updated guide available for Stack Outputs and References if you'd like to check that out in the meantime.

toriancrane avatar Nov 06 '23 11:11 toriancrane