-
|
I have a CDKTF project with multiple stacks. I'm using custom workflows in atlantis. Are there canonical examples of how to plan/apply this particular setup? I'm having some trouble figuring out how to use the $PLANFILE when there are multiple stacks that need to be planned and applied, and especially when they have interstack dependencies. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hi @paymog! I'm Dosu and I’m helping the atlantis team. Atlantis supports multi-stack CDKTF projects by treating each stack as a separate project, usually mapped to a directory containing a generated To handle interstack dependencies, use the Here’s a canonical example structure (docs, docs): version: 3
parallel_plan: true
parallel_apply: true
projects:
- name: stack-a
dir: stacks/stack-a
workflow: cdk-workflow
execution_order_group: 1
- name: stack-b
dir: stacks/stack-b
workflow: cdk-workflow
execution_order_group: 2
depends_on:
- stack-a
workflows:
cdk-workflow:
plan:
steps:
- run: cdktf synth
- run: terraform init -input=false
- run: terraform plan -input=false -refresh -out $PLANFILE
apply:
steps:
- run: terraform apply $PLANFILEEach project’s workflow uses Let me know if you want a more detailed example or have a specific workflow you’re trying to implement! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
If your two stacks aren't in different directories, you can still configure them as separate Atlantis projects by giving each a unique name (and, if needed, workspace) in your
atlantis.yaml. For example, both projects can have the samedir, but must have differentnamevalues—this is required if they share the same directory and workspace, and is enforced by Atlantis validation. This lets Atlantis manage plan/apply for each stack independently, even within the same directory. See the official example here:For CDKTF, you typically distinguish stacks by the generated
c…