-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Description
Terraform Version
Terraform v1.9.5
on darwin_arm64Use 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."
Note: Terraform test files only support local and registry modules within the source attribute.
(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 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