Hi,
I have this directory structure:
|-- modules
| |-- network
| `-- services
| `-- frontend-app
`-- sample_customer
|-- network
|-- services
| `-- frontend-app
I just a question regarding cross referencing variables:
Under modules -> network ->
main.tf, I have this resource declared:
resource "aws_subnet" "subnet1" {
cidr_block = "${element(var.subnet, 0)}"
availability_zone = "${element(var.availability_zone, 0)}"
Under modules -> network ->
output.tf, I have this declaration:
I need to reference this variable subnet output under network module to be used in frontend-app module.
So here's how i cross reference it:
Under sample_customer -> services -> frontend-app ->
main.tf
source = "../../../modules/services/frontend/"
subnet1 = "${module.network.subnet1}"
If i do this, i get an error: * module 'frontend': unknown module referenced: network
So my question is, how can i reference a variable from another module? It's really causing me confusion.
Thanks!