-
-
Notifications
You must be signed in to change notification settings - Fork 540
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: Hook terraform_wrapper_module_for_each should use versions.tf from the module if it exists #657
feat: Hook terraform_wrapper_module_for_each should use versions.tf from the module if it exists #657
Conversation
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'm not sure that I agree or fully understand the reasoning for this PR. Let me think a bit and come back to it on Monday.
The context from how I understood author's idea: it either pre-defined quite permissive constraint (see screenshot) or the user can provide it's own configuration. While it looks more or less safe, I'd support @antonbabenko hesitaion as that user-provided file may contain something irrelevant and hence user can inadvertently shoot their leg. Just thoughts aloud. ps: I'll take by approval back to prevent accidental merge to allow Anton to has his "veto" take actual effect. |
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 now understand the reason for this PR - if the module requires something (e.g. providers of certain versions or the specific range of the Terraform versions), so should the wrapper do, too.
This is a new feature, not a small fix.
# [1.89.0](v1.88.4...v1.89.0) (2024-04-15) ### Features * Hook terraform_wrapper_module_for_each should use versions.tf from the module if it exists ([#657](#657)) ([b127601](b127601))
This PR is included in version 1.89.0 🎉 |
Put an
x
into the box if that apply:Description of your changes
Rather than having
hooks/terraform_wrapper_module_for_each.sh
always createversions.tf
for us, if the module hasversions.tf
, use that instead.We want to do this because if your module uses a non-Hashicorp provider and
versions.tf
doesn't have a the requiredrequired_providers
config, then Terraform will try to download the provider from Hashicorp (i.e., for the env0 provider, it would try to downloadhashicorp/env0
which doesn't exist and NOTenv0/env0
)... We COULD set this in the deployment code; however, if you're using Terragrunt and you configure the provider with therequired_providers
config, then if you use a root module (with properversions.tf
) with the provider, then you get a conflict because you haverequired_providers
configured in the module ANDrequired_providers
configured in the deployment code.How can we test changes
When you run pre-commit,
wrappers/versions.tf
should be copied from / the same as/versions.tf
.