Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support project-level Terraform distribution selection #5167

Merged
merged 14 commits into from
Jan 3, 2025

Conversation

abborg
Copy link
Contributor

@abborg abborg commented Dec 15, 2024

what

  • Add terraform_distribution project config value
  • Project-level terraform_distribution config value overrides server default
  • Refactor terraform client to avoid cyclic dependencies

why

  • Enable Atlantis to manage multiple stacks or repos with different TF distributions
  • Supports migration from Terraform to OpenTofu project-by-project to de-risk migration

tests

  • I have tested my changes by running unit tests
  • I have tested my changes by creating a test PR that exercises the new functionality

references

Supports #3741

@abborg abborg requested review from a team as code owners December 15, 2024 22:13
@abborg abborg requested review from chenrui333, lukemassa and nitrocode and removed request for a team December 15, 2024 22:13
@github-actions github-actions bot added the go Pull requests that update Go code label Dec 15, 2024
@dosubot dosubot bot added the feature New functionality/enhancement label Dec 15, 2024
@abborg abborg changed the title Support project-level Terraform distribution selection feat:Support project-level Terraform distribution selection Dec 15, 2024
@abborg abborg changed the title feat:Support project-level Terraform distribution selection feat: Support project-level Terraform distribution selection Dec 15, 2024
Add support for terraform_distribution config value in project config.
This config value behaves similarly to terraform_version whereby defaults
taken from the server config will be overridden by project-level values.

Also refactor to prevent terraform client slightly to prevent
cyclical dependencies.

Signed-off-by: Andrew Borg <[email protected]>
@jamengual
Copy link
Contributor

@abborg thanks for the contribution, please gives us some time to review.

@X-Guardian
Copy link
Contributor

@abborg, can you update the relevant documentation in the runatlantis.io directory with your changes.

@X-Guardian X-Guardian added the waiting-on-response Waiting for a response from the user label Dec 17, 2024
@github-actions github-actions bot added the docs Documentation label Dec 17, 2024
@abborg
Copy link
Contributor Author

abborg commented Dec 17, 2024

I've updated the relevant documentation. Please let me know if there's any further changes desired.

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good @abborg. Just a few suggestions.

cmd/server.go Outdated Show resolved Hide resolved
cmd/server_test.go Show resolved Hide resolved
server/core/config/raw/project.go Outdated Show resolved Hide resolved
server/core/runtime/apply_step_runner.go Show resolved Hide resolved
server/core/terraform/tfclient/terraform_client.go Outdated Show resolved Hide resolved
server/core/terraform/tfclient/terraform_client.go Outdated Show resolved Hide resolved
server/user_config.go Outdated Show resolved Hide resolved
@X-Guardian
Copy link
Contributor

@abborg
Copy link
Contributor Author

abborg commented Dec 18, 2024

There are some test failures too: https://github.com/runatlantis/atlantis/actions/runs/12394308257/job/34599029347?pr=5167

@X-Guardian I should be able to apply your suggestions and fix remaining test failures later today.

@github-actions github-actions bot added build Relating to how we build Atlantis github-actions labels Dec 20, 2024
@abborg
Copy link
Contributor Author

abborg commented Dec 20, 2024

@X-Guardian I made a mistake when attempting to correct a commit missing a signoff and it appears I mistakenly signed off some commits from the earlier merges of main. Please let me know how you'd like me to proceed.

Edit: I was able to checkout the previous head, make the correct signoff and then push the changes.

@obscurerichard
Copy link

obscurerichard commented Dec 21, 2024

It looks like this relates to the OpenTofu epic #3741 - does this also provide a resolution to Support OpenTofu auto download #4339?

(I'm not one of the Atlantis developers, just an interested Atlantis user starting to experiment with OpenTofu - and this is very exciting to see!)

@abborg
Copy link
Contributor Author

abborg commented Dec 23, 2024

It looks like this relates to the OpenTofu epic #3741 - does this also provide a resolution to Support OpenTofu auto download #4339?

(I'm not one of the Atlantis developers, just an interested Atlantis user starting to experiment with OpenTofu - and this is very exciting to see!)

I believe that prior to these proposed changes, the distribution used as the server default could be auto-downloaded. The OpenTofu downloader uses the tofudl package to resolve version constraints and download the corresponding version. The Terraform downloader uses hc-install. However, it would not be currently possible to auto-download both OpenTofu and Terraform. With these proposed changes, auto-downloading both distributions would be supported provided the projects specified the appropriate distribution and version combination.

@abborg abborg requested a review from X-Guardian December 23, 2024 05:06
@jamengual jamengual added waiting-on-review Waiting for a review from a maintainer and removed waiting-on-response Waiting for a response from the user labels Dec 31, 2024
Copy link
Contributor

@lukemassa lukemassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, nice contribution!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 3, 2025
@jamengual jamengual dismissed X-Guardian’s stale review January 3, 2025 05:01

PR, has been updated

@jamengual jamengual merged commit 9e0f3d1 into runatlantis:main Jan 3, 2025
40 of 42 checks passed
kvanzuijlen pushed a commit to kvanzuijlen/atlantis that referenced this pull request Jan 4, 2025
…ntis#5167)

Signed-off-by: Andrew Borg <[email protected]>
Co-authored-by: PePe Amengual <[email protected]>
Co-authored-by: Simon Heather <[email protected]>
Signed-off-by: kvanzuijlen <[email protected]>
lukaspj pushed a commit to lukaspj/atlantis that referenced this pull request Jan 8, 2025
…ntis#5167)

Signed-off-by: Andrew Borg <[email protected]>
Co-authored-by: PePe Amengual <[email protected]>
Co-authored-by: Simon Heather <[email protected]>
Signed-off-by: Lukas Peter Aldershaab <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Relating to how we build Atlantis docs Documentation feature New functionality/enhancement github-actions go Pull requests that update Go code lgtm This PR has been approved by a maintainer waiting-on-review Waiting for a review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants