Skip to content

Uploaded plan filenames#4

Closed
gsavage wants to merge 2 commits intomainfrom
uploaded-plan-filenames
Closed

Uploaded plan filenames#4
gsavage wants to merge 2 commits intomainfrom
uploaded-plan-filenames

Conversation

@gsavage
Copy link
Copy Markdown
Contributor

@gsavage gsavage commented Apr 29, 2026

No description provided.

gsavage and others added 2 commits April 28, 2026 16:09
When a single repo contains multiple Terraform stacks (e.g. the
sub-stacks under terraform-server), each stack needs its own state file
under the same S3 backend bucket. The original fivexl tf.sh supports
this through a TF_STATE_FILE_NAME env var (defaulting to main.tfstate),
sourced from a per-stack tf.sh.env file. Our Python rewrite hardcoded
main.tfstate, which would have caused every stack in the same repo to
collide on one state file.

Plumb a state_file_name argument through TfBackend and resolve it from
TF_STATE_FILE_NAME (default main.tfstate) when building the backend.
The variable can be set in the shell or in tf.env, which tf already
loads on startup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The human-readable plan was always written to /tmp/tfplan.txt, so when
the reusable workflow runs in a matrix every uploaded artifact contained
a file with the same name. Downloading several at once made it
impossible to tell which plan belonged to which environment.

Write the plan to /tmp/${environment}.plan.txt instead, so the file
inside each artifact is identifiable on its own (e.g. staging.plan.txt,
prod-us.plan.txt).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gsavage gsavage closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant