1

I am working with terraform and I like a lot to see the values of the outputs in the standard out, for example:

Apply complete! Resources: 1 added, 1 changed, 1 destroyed.

Outputs:

database_port = 1234
elb_dns_name = myELB-4657823454.eu-central-1.elb.amazonaws.com

However, when working with modules, the outputs are not shown.

My hypothesis is that, as the terraform apply command is not executed in the same path as the resources are declared, the outputs are not shown in the terminal when it finishes.

Is there any workaround to see the outputs even when I am working with modules?

(Just as a clarification, the outputs flow across the modules of the project correctly, just need a hint to get them printed from the path where I start the execution)

Arcones
  • 3,954
  • 4
  • 26
  • 46
  • Possible duplicate of ['Not a valid output for module' when using output variable with terraform](https://stackoverflow.com/questions/48084463/not-a-valid-output-for-module-when-using-output-variable-with-terraform) – ydaetskcoR Dec 02 '18 at 14:50
  • @ydaetskcoR my question is not the same as the other as that one addresses the way to pass output values through modules but not the way they get printed in sout (in every moment, in my project the output flow was correct). in any case thank you to pointed this out :) – Arcones Dec 02 '18 at 18:43

1 Answers1

1

Modules output are used to interact with the module from the "main" module.

On stdout, you only see the output of the "main" module, thus if you want to see an output of the module, you must output module's output.

See output terraform modules usage

smaftoul
  • 2,375
  • 17
  • 14
  • I get the expected behaviour by passing through the module outputs to the main outputs with the value = "${module.name_of_my_module.name_of_my_output}" – Arcones Dec 02 '18 at 20:37