Open VladRassokhin opened 5 years ago
It can be even simplified to just one file with content module "r" { source = "./"}
any solution ?
any solution ?
Any thoughts on achieving this? I've got a similar issue with recursive modules.
https://discuss.hashicorp.com/t/are-recursive-modules-even-a-possibility-in-terraform/42745
I was running into this issue and realized that the issue was being caused by having my TF module inside a parent directory. Ex:
|
-- ec2/
|
--- key_pair/
- main.tf
- variables.tf
- outputs.tf
And I was trying to reference key_pair
it in my Terratests like so
func generateEC2KeyPair(t *testing.T, target string, keyName string) *terraform.Options {
return terraform.WithDefaultRetryableErrors(t, &terraform.Options{
TerraformDir: "./modules/ec2/key_pair",
Vars: map[string]interface{}{
"key_name": keyName,
},
Targets: []string{target},
})
}
All I had to do was remove the parent ec2
directory
Current Terraform Version
Use-cases
It may happen that two or more modules depends on each other. Instead of producing cyptinc error terraform could detect that. Given project structure:
with content of
main.tf
asmodule "a" { source = "./a"}
anda/a.tf
asmodule "p" { source = "./../"}
terraform init
outputs some not easy to understand messages, like:Full log in gist
Proposal
Ensure that modules graph is acyclic before trying to create module directories under
.terraform/modules
References
15276