Open kaje783 opened 9 months ago
Hello, from what I read, I thought about:
References: https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes/#include https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes/#generate
Problem
First of all, thank you for this great software, adds many great functions on top of terrafrom.
I've already gotten used to it a bit and I'm getting along pretty well with it. Now I'm just faced with a problem. I would like networks deployed via nsxt and vms via vsphere and that via separate modules. So I would like to follow your path and separate as much as possible from each other. My problem now is that I want to use the networks created in NSXT in Vsphere, but I always get the following error message:
I suspect the problem arises because the network does not yet exist and are create in the plan phase of nsxt but vsphere is not aware of it.
Short note: this works in a single Terraform file.
Ideas for a solution would be to combine it in a module, but that wouldn't be very clean. Another idea would be to use the same remote_state file, but as far as I know that doesn't work.
Another idea is to pass on the network name as in the example of nsxt create networks for vsphere to vsphere. It just doesn't do anything for me, because in the planning phase the output is empty. I would rather read the network name directly from the var file and use it in vpshere
I hope you have a few ideas on how we can solve the problem. If any information is missing, please just say.
I then attached the complete test_config.
Note: I removed all specific information and inserted a placeholder
Workflow
terragrunt run-all init
terragrunt run-all plan
Config
Folder structure
Main -> terragrunt.hcl -> env.json -> ci_cd.json -> vcf --> terragrunt.hcl --> env_vcf.json --> network ---> terragrunt.hcl --> vm ---> terragrunt.hcl ->module --> network ---> main.tf ---> var.tf ---> provider.tf --> vm ---> main.tf ---> var.tf ---> provider.tf
Main/terragrunt.hcl
Main/env.json
Main/ci_cd.json
Main/vcf/terragrunt.hcl
Main/vcf/env_vcf.json
Main/vcf/network/terragrunt.hcl
Main/vcf/vm/terragrunt.hcl
Main/module/network/main.tf
Main/module/network/var.tf
Main/module/network/provider.tf
Main/module/vm/main.tf
Main/module/vm/var.tf
Main/module/vm/provider.tf
Links
nsxt create networks for vsphere
Provider
vsphere nsxt
Version