terraform-community-modules / tf_aws_vpc

[DEPRECATED] Use https://github.com/terraform-aws-modules/terraform-aws-vpc
Other
211 stars 203 forks source link

Outputs does not work at all #48

Closed NeckBeardPrince closed 7 years ago

NeckBeardPrince commented 7 years ago
Apply complete! Resources: 18 added, 3 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path:

Nothing in the output.

ashb commented 7 years ago

Assuming you used this a module you will need to add outputs yourself. I can't find it right now but somewhere in the TF docs it mentions that outputs from the top level will only be the ones you define with an output {} block yourself.

module "vpc" { ... }

output "vpc_id" {
  value = "${module.vpc.vpc_id}"
}
dyindude commented 7 years ago

The docs for modules have an example that shows this behavior:

https://www.terraform.io/docs/modules/create.html Let's add a variable and an output to our child module.

variable "memory" {}

output "received" {
 value = "${var.memory}"
}

This will create a required variable, memory, and then an output, received, that will be the value of the memory variable.

You can then configure the module and use the output like so:

module "child" {
 source = "./child"

 memory = "1G"
}

output "child_memory" {
 value = "${module.child.received}"
}
ghost commented 7 years ago

@NeckBeardPrince: Do you face still face issues with using modules?

thomasbiddle commented 7 years ago

@NeckBeardPrince This is a Terraform limitation, which may or may not be by design - Module outputs are not displayed as an output when running a terraform apply however they can be used to pass to other modules, via "${module.vpc.vpc_id}" as an example, such as @ashb said.

Not sure who maintains this repo.. but @phinze @antonbabenko this can probably be closed.