-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: main
Are you sure you want to change the base?
Conversation
eb00fc3
to
fa5d310
Compare
{ | ||
"OverrideRepositoryWithLayer", | ||
&configv1alpha1.TerraformRepository{ | ||
Spec: configv1alpha1.TerraformRepositorySpec{ | ||
OpenTofuConfig: configv1alpha1.OpenTofuConfig{ | ||
Version: "1.0.1", | ||
}, | ||
}, | ||
}, | ||
&configv1alpha1.TerraformLayer{}, | ||
"1.0.1", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a duplicate of OnlyRepositoryVersion
.
The "correct" OverrideRepositoryWithLayer
is a few lines below.
OpenTofuConfig OpenTofuConfig `json:"opentofu,omitempty"` | ||
TerragruntConfig TerragruntConfig `json:"terragrunt,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must remember to put these changes as breaking in the next release
ExecPath: filepath.Join(binaryPath, "OpenTofu", baseExecVersion, "tofu"), | ||
} | ||
} else { | ||
return nil, errors.New("Please enable either Terraform or OpenTofu in the repository or layer configuration") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an user forgets to enable Terraform or OpenTofu in their CRDs, it would be better to be informed before a runner is spawned.
It can be more intuitive to the user (searching through runner logs is not obvious), maybe it can be checked by the Layer controller or the Run controller ?
Terraform *terraform.Terraform | ||
OpenTofu *opentofu.OpenTofu |
There was a problem hiding this comment.
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:
- We add another function to the
TerraformExec
interface to obtain the execution path of the tool - We just give a string
BaseToolPath
to theTerragrunt
struct instead of a pointer to an object
Overall very great Pull Request! 👏 |
This makes it possible to use opentofu instead of terraform. It involves some CRD modifications:
spec.terraform.enabled
andspec.terragrunt.enabled
Todo: