pulumi / docs

All things Pulumi docs!
https://pulumi.com
Apache License 2.0
122 stars 208 forks source link

Issue with https://www.pulumi.com/learn/building-with-pulumi/stack-outputs/ #10225

Open eguerlain opened 8 months ago

eguerlain commented 8 months ago

The very last instruction to run on the "Understanding Stack Outputs" page is pulumi up, in order to see the difference between the dev and the staging stacks.

Now, if you run pulumi up while in the staging stack, we should see that the frontend port is now set to 3002:

However, at this point, the dev stack is "up". When running pulumi up on the staging stack, I get this plan:

     Type                         Name                  Plan       
 +   pulumi:pulumi:Stack          my_first_app-staging  create     
 +   ├─ docker:index:RemoteImage  mongoImage            create     
 +   ├─ docker:index:RemoteImage  frontendImage         create     
 +   ├─ docker:index:RemoteImage  backendImage          create     
 +   ├─ docker:index:Network      network               create     
 +   ├─ docker:index:Container    mongoContainer        create     
 +   ├─ docker:index:Container    frontendContainer     create     
 +   └─ docker:index:Container    backendContainer      create    

Applying it result in an error when creating the mongoContainer since the port 27017 is already allocated.

Diagnostics:
  docker:index:Container (mongoContainer):
    error: 1 error occurred:
        * creating urn:pulumi:staging::my_first_app::docker:index/container:Container::mongoContainer: 1 error occurred:
        * Unable to start container: Error response from daemon: driver failed programming external connectivity on endpoint mongo-staging (148d4ec22fc40525a0bbcd2ebd54b27d7f09d6ec678280dbf9ced6c05e1417ff): Bind for 0.0.0.0:27017 failed: port is already allocated

  pulumi:pulumi:Stack (my_first_app-staging):
    error: update failed

I am just starting with Pulumi, maybe I have not fully grasped all the concepts.
However, I think that there is a missing instruction pulumi stack select dev && pulumi destroy && pulumi stack select staging before running pulumi up to remove resources of the dev stack before creating those of the staging stack.

This method is a little bit annoying since the docker images are removed to be pulled again in the pulumi up, but a least I'm able to "up" the staging stack.

toriancrane commented 8 months ago

Thank you for submitting this issue @eguerlain ! We will take a look into this.