You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a number of reusable Terraform modules developed in a specific GitHub repository (.../cie-terraform-modules) to implement patterns that recur in our infrastructure across multiple projects.
Some of these modules are for repetitive infrastructure tasks (e.g. a Lambda function with the Datadog serverless extension, TLS CA certs for our intranet, etc already configured). Some others are for tasks that may be very small but have nonetheless proven useful in tests (e.g. generating a random string for an environment name, creating a temporary directory to hold files, etc).
The problem is that Git does not appear to be supported, returning the error "Only local or registry module sources are currently supported from within test run blocks."
Note: Terraform test files only support local and registry modules within the source attribute.
So, TL;DR: I would like to be able to use Terraform modules from Git repositories in run blocks.
Attempted Solutions
I create a module in the local repository to wrap the module from the Git repository. It consists only of a variables.tf, outputs.tf, main.tf, and a file with the module { } block that relays the variables and outputs.
This works but creates a rather fragile coupling that needs to be updated whenever the API of the upstream module changes. It's also a bit confusing if you see such-and-such-module does not provide such-and-such-output, but you look at the upstream module and it very much does -- it just wasn't added into the "wrapper" module.
Proposal
Permit run blocks to support Git module sources.
References
No response
The text was updated successfully, but these errors were encountered:
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!
I want to see this ASAP. The workaround (create a local module that just calls the remote Git module) scales poorly when you have 10+ modules combined.
Given that the module block supports Git sources elsewhere I'm a little surprised this wasn't provided by default? Why was it omitted?
Terraform Version
Use Cases
I have a number of reusable Terraform modules developed in a specific GitHub repository (
.../cie-terraform-modules
) to implement patterns that recur in our infrastructure across multiple projects.Some of these modules are for repetitive infrastructure tasks (e.g. a Lambda function with the Datadog serverless extension, TLS CA certs for our intranet, etc already configured). Some others are for tasks that may be very small but have nonetheless proven useful in tests (e.g. generating a random string for an environment name, creating a temporary directory to hold files, etc).
The problem is that Git does not appear to be supported, returning the error "Only local or registry module sources are currently supported from within test run blocks."
(from https://developer.hashicorp.com/terraform/language/tests)
So, TL;DR: I would like to be able to use Terraform modules from Git repositories in
run
blocks.Attempted Solutions
I create a module in the local repository to wrap the module from the Git repository. It consists only of a
variables.tf
,outputs.tf
,main.tf
, and a file with themodule { }
block that relays the variables and outputs.This works but creates a rather fragile coupling that needs to be updated whenever the API of the upstream module changes. It's also a bit confusing if you see such-and-such-module does not provide such-and-such-output, but you look at the upstream module and it very much does -- it just wasn't added into the "wrapper" module.
Proposal
Permit
run
blocks to support Git module sources.References
No response
The text was updated successfully, but these errors were encountered: