hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.68k stars 9.55k forks source link

Using an attribute in template_file data source hangs when inside a module #10122

Closed jsonmaur closed 7 years ago

jsonmaur commented 7 years ago

Terraform Version

0.7.10

Affected Resource(s)

Terraform Configuration Files

main.tf
module "testing" {
  source = "./my-module"
}
my-module/main.tf
data "template_file" "main" {
  template = "$${val}"
  vars {
    val = "${null_resource.main.id}"
  }
}

resource "null_resource" "main" { }

Debug Output

...
2016/11/15 00:54:03 [ERROR] No DOT origin nodes found.
...
2016/11/15 00:54:08 [DEBUG] vertex "meta.count-boundary (count boundary fixup)", waiting for: "module.testing.data.template_file.main"
2016/11/15 00:54:13 [DEBUG] vertex "meta.count-boundary (count boundary fixup)", waiting for: "module.testing.data.template_file.main"

Expected Behavior

It should create the resource and complete the process.

Actual Behavior

It creates the resource, but Terraform completely hangs with the message module.testing.data.template_file.main: Refreshing state.... Pressing ctrl+c shows Interrupt received. Gracefully shutting down..., but still never completes the process. In debug mode, it shows the above "DEBUG" message every 5 seconds. Everything works fine after a second apply.

Steps to Reproduce

  1. terraform get
  2. terraform apply

Works as expected if modules are not used. Could be related to https://github.com/hashicorp/terraform/issues/10014.

jsonmaur commented 7 years ago

Thanks for the quick response! 👍

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.