millions-pharmacist-626
04/06/2023, 1:08 PMdev
and prod
, but they both want to use the same IAM Role. Should I create a separate stack just for the role, and then use stackReference in the other projects?little-library-54601
04/06/2023, 1:21 PMsalmon-account-74572
04/06/2023, 1:24 PMmillions-pharmacist-626
04/06/2023, 1:28 PMdev
and prod
and run pulumi up
in either of them, I assume that pulumi would either get confused about what to do with the role, OR try to recreate it / update it. Which would be pointless since the role is already there.
I have come up with an idea which I'm gonna test soon, but I'm not sure if that's a proper approach. Give me about 30 minutessalmon-account-74572
04/06/2023, 2:03 PMmillions-pharmacist-626
04/06/2023, 2:06 PMstaging
bucket.
Once I know everything works, I will deploy the prod stack which is going to create a separate job that parses prod data in a production
bucket.
That's more or less the gist of itsalmon-account-74572
04/06/2023, 2:09 PMmillions-pharmacist-626
04/06/2023, 2:24 PMproject
├── job1/
│ └── __init__.py
├── job2/
│ └── __init__.py
├── __main__.py
├── iam.py
├── Pulumi.yaml
├── Pulumi.iam.yaml
└── Pulumi.dev.yaml
In __main__.py
, I have the following code:
import pulumi
current_stack = pulumi.get_stack()
if current_stack == "iam":
import iam
else:
import job1, job2
This way, if the stack is iam
, only the IAM role and policies are gonna get updated. Else, the actual glue jobs.
In the glue jobs definitions I use stack reference with require
to the ARN exported by iam.py
, so the program crashes if no export is found. What do you think ?salmon-account-74572
04/06/2023, 2:29 PMmillions-pharmacist-626
04/06/2023, 2:31 PMsalmon-account-74572
04/06/2023, 2:34 PMmillions-pharmacist-626
04/06/2023, 2:38 PMdocument this arrangement really wellgood idea. I'm definitely gonna forget in 12 months ahahaha 😄 Since you're here, I have one last question. I noticed that the newly created stack (in this case,
iam
), doesn't have the vcs:
tags set yet.
I know these tags are set automatically by pulumi but I'm not sure when.
I'm asking cause it's convenient when browsing the UI to see the different stacks grouped together.
Right now it shows like this:salmon-account-74572
04/06/2023, 2:41 PMvcs
tags automatically if their in a version control repository, but if they aren’t you can manually set the vcs
tags to group them together: https://www.pulumi.com/docs/reference/cli/pulumi_stack_tag/millions-pharmacist-626
04/06/2023, 2:45 PMiam
and related code was created later.
Nonetheless, the vcs
tags are currently missing. I did not set them manually. See:salmon-account-74572
04/06/2023, 2:47 PMmillions-pharmacist-626
04/06/2023, 2:47 PM