# Accessing output from module in Terraform 12

**URL:** <https://discuss.hashicorp.com/t/accessing-output-from-module-in-terraform-12/5462>\
**Category:** Terraform\
**Created:** [January 28, 2020, 3:40pm UTC](https://discuss.hashicorp.com/t/accessing-output-from-module-in-terraform-12/5462 "2020-01-28T15:40:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suaswe](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/suaswe/32/4279_2.png) [@suaswe](https://discuss.hashicorp.com/u/suaswe)\
**Post date:** [January 28, 2020, 3:40pm UTC](https://discuss.hashicorp.com/t/accessing-output-from-module-in-terraform-12/5462/1 "2020-01-28T15:40:09Z")

</div>

HI all!

I have a module that creates a lambda function and some related stuff. I want this module to output the ARN of the lambda it creates, however I can’t seem to get it to output anything.

At present I have configured the following output in the module for testing purposes (the variable testing is defined elsewhere):

```
# cat outputs.tf 
output "testing" {
  value = var.testing
}

```

I’m calling the module as follows:

```
module "function_deploy" {
  source = "git::https://module/"

  function_name = "name"
  function_handler = "lambda.lambda_handler"
  function_runtime = "python3.6"
  vpc_function = "false"
}

```

It applies fine, the function is built using the newest version of the module, there are no errors and everything is dandy, except no output is produced. Statefile shows:

```
  "outputs": {},

```

What am I missing here?

Thanks!

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [January 28, 2020, 5:16pm UTC](https://discuss.hashicorp.com/t/accessing-output-from-module-in-terraform-12/5462/2 "2020-01-28T17:16:11Z")

</div>

Hi @suaswe,

An output from a child module is exposed for use by its calling module, not at the root. In order to see this in the `terraform apply` output and in the outputs part of the state snapshot you’ll need to export it from the root module too:

```auto
output "testing" {
  value = module.function_deploy.testing
}

```

Each module instance has its own separate set of output values, and only the ones from the root module (the one containing your `module "function_deploy"` block) are exposed as outputs for the configuration as a whole.

---

<div class="post-metadata">

**Author:** ![suaswe](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/suaswe/32/4279_2.png) [@suaswe](https://discuss.hashicorp.com/u/suaswe)\
**Post date:** [January 29, 2020, 9:09am UTC](https://discuss.hashicorp.com/t/accessing-output-from-module-in-terraform-12/5462/3 "2020-01-29T09:09:24Z")

</div>

Thank you, I figured it out shortly after posting. 🙂 I was hoping I could keep the output in a “centralised” location (i.e. the module I’m calling) but I see now that I cannot.

---

<div class="post-metadata">

**Author:** ![DevOpsRob](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/devopsrob/32/1607_2.png) [@DevOpsRob](https://discuss.hashicorp.com/u/DevOpsRob)\
**Post date:** [March 18, 2020, 11:24am UTC](https://discuss.hashicorp.com/t/accessing-output-from-module-in-terraform-12/5462/4 "2020-03-18T11:24:14Z")

</div>

I’m still trying to figure this one out a bit. I have created a module and in there, I have specified an output. I then go to use that module with a count number of 3 and want to reference the output from that module in another resource. As i’m using count, it adds a layer of complexity that I can’t seem to solve. Any ideas @apparentlymart
