docs: Promote Terraform distribution agnosticism in Terragrunt example#6620
Open
lachlankidson wants to merge 3 commits into
Open
docs: Promote Terraform distribution agnosticism in Terragrunt example#6620lachlankidson wants to merge 3 commits into
lachlankidson wants to merge 3 commits into
Conversation
Signed-off-by: Lachlan Kidson <lachlankidson@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Terragrunt custom workflow documentation to avoid hardcoding terraform/tofu, enabling mixed Terraform/OpenTofu repositories to work cleanly with Atlantis’ per-project distribution selection.
Changes:
- Replace
terraform${...}hardcoding in TerragruntTG_TF_PATHexamples with${ATLANTIS_TERRAFORM_DISTRIBUTION}${ATLANTIS_TERRAFORM_VERSION}. - Remove usage of
DEFAULT_TERRAFORM_VERSIONin the example workflow.
| - env: | ||
| name: TG_TF_PATH | ||
| command: 'echo "terraform${DEFAULT_TERRAFORM_VERSION}"' | ||
| command: 'echo "${ATLANTIS_TERRAFORM_DISTRIBUTION}"' |
Contributor
Author
There was a problem hiding this comment.
See DEFAULT_TERRAFORM_VERSION / DEFAULT_OPENTOFU_VERSION notes in references section of the PR description. This suggestion might be a good one, but its a divergence from the previous behaviour, similarly we'd want to make the same change to L334.
Signed-off-by: Lachlan Kidson <lachlankidson@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
Updates the terragrunt example documentation to be terraform distribution agnostic.
(i.e. no longer hardcode
terraformortofu).why
This allows for Atlantis + terragrunt to manage repositories where there are both terraform and tofu projects present, e.g. an atlantis.yaml similar to:
tests
We're using this approach successfully in our own repositories.
references
Environment variables set here:
atlantis/server/core/runtime/run_step_runner.go
Lines 59 to 61 in ac39085
Resolves to either
tofuorterraform, confirmed by tests:atlantis/server/core/terraform/distribution_test.go
Lines 14 to 17 in ac39085
atlantis/server/core/terraform/distribution_test.go
Lines 26 to 29 in ac39085
DEFAULT_TERRAFORM_VERSIONremoved as it refers to terraform specifically, the tofu equivalent isDEFAULT_OPENTOFU_VERSION:atlantis/Dockerfile
Lines 9 to 11 in ac39085
which is not required as both
tofuandterraform's default versions are symlinked:atlantis/scripts/download-release.sh
Line 33 in ac39085
ATLANTIS_TERRAFORM_VERSIONcan either be specified by projects/pins or derived if not present:atlantis/cmd/server.go
Lines 490 to 493 in ac39085