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: add support for opentofu #328

Merged
merged 11 commits into from
Oct 18, 2024
Merged

feat: add support for opentofu #328

merged 11 commits into from
Oct 18, 2024

Conversation

LucasMrqes
Copy link
Collaborator

@LucasMrqes LucasMrqes commented Sep 13, 2024

This makes it possible to use opentofu instead of terraform. It involves some CRD modifications:

  • Terragrunt configuration is no longer under terraform config in TerraformRepository & Layer spec
  • One can choose between terraform and opentofu as base executor for infra as code in layer and repositories config with spec.terraform.enabled and spec.terragrunt.enabled
  • Validation rules prevent users from setting both parameters to true
  • Layer config overrides Repo config.

Todo:

  • Update CRDs
  • Integrate opentofu to runner
  • Add tests, specifically for parameter merge edge cases
  • Fix test data used in runner & end-to-end tests
  • Update documentation
  • Better, dynamic logging with less hardcoded references to "terraform"

@LucasMrqes LucasMrqes force-pushed the feat/opentofu-support branch from eb00fc3 to fa5d310 Compare September 23, 2024 22:20
@LucasMrqes LucasMrqes marked this pull request as ready for review September 23, 2024 22:27
api/v1alpha1/common_test.go Outdated Show resolved Hide resolved
api/v1alpha1/terraformlayer_types.go Show resolved Hide resolved
internal/runner/tools/install.go Show resolved Hide resolved
Comment on lines 15 to 16
Terraform *terraform.Terraform
OpenTofu *opentofu.OpenTofu
Copy link
Member

Choose a reason for hiding this comment

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

I think we can abstract the tool used to have only one property. For Terragrunt, we only need the execution path of the tool.

I see 2 solutions:

  1. We add another function to the TerraformExec interface to obtain the execution path of the tool
  2. We just give a string BaseToolPath to the Terragrunt struct instead of a pointer to an object

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like the first idea, but this makes the exec patterns a little more complicated tho; check my last commit, wdyt ?

@corrieriluca
Copy link
Member

Overall very great Pull Request! 👏
It opens Burrito to the world of OpenTofu 😄

@LucasMrqes LucasMrqes linked an issue Oct 18, 2024 that may be closed by this pull request
@LucasMrqes LucasMrqes force-pushed the feat/opentofu-support branch from ad3d4bf to b364f56 Compare October 18, 2024 13:13
@LucasMrqes LucasMrqes merged commit 49b466f into main Oct 18, 2024
5 checks passed
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.

feat(runner): support opentofu
2 participants