Use module output

terraform-syntax
terraform
#1

Hello,

is it possible to get output from module like this ?:

module "foo" {
    ...
} 

output "id" {
    value = ["${bar.this.*.id}"]
}

ressource "res" {
    bar = ${element(module.foo.*.id, count.index)}
}

I don’t know how to use output from module.
Any help ?
thanks drug

#2

Use, the syntax is module.NAME.ATTRIBUTE. For your example, it would be module.foo.id, where id is an output variable in that module. See Using Modules for more info.