Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use module outputs as input to another module #822

Closed
mcoms opened this issue Jan 16, 2015 · 5 comments
Closed

Can't use module outputs as input to another module #822

mcoms opened this issue Jan 16, 2015 · 5 comments

Comments

@mcoms
Copy link

mcoms commented Jan 16, 2015

If I try to use a module output as the input to another module, I get an error when running terraform plan, v0.3.5.

# main.tf
module "cluster_leader" {
  source = "./leader"
}

module "cluster_follower_1" {
  source = "./follower"
  leader_ip = "${module.cluster_leader.private_ip}"
}

module "cluster_follower_2" {
  source = "./follower"
  leader_ip = "${module.cluster_leader.private_ip}"
}
# leader/main.tf
...
output "private_ip" { value = "${aws_instance.server.private_ip}" }
# follower/main.tf
variable "leader_ip" {}
...
➜  terraform plan
Refreshing Terraform state prior to plan...
...
Error refreshing state: Output field 'private_ip' not found for variable 'module.cluster_leader.private_ip'

Ideally, I'd like for Terraform to calculate that the followers depend on the leader, or the option to specify depends_on for modules.

@mitchellh
Copy link
Contributor

I believe this was fixed in 0.3.6. But I've tagged it as a bug and will verify later.

@xueshanf
Copy link

I am on 0.3.6 version and just tried it, same problem. Originally reported the issue on version 0.3.5, #697.

@mitchellh
Copy link
Contributor

This is fixed on master, since #1010

@mcoms
Copy link
Author

mcoms commented Feb 20, 2015

Thanks! 👍

@ghost
Copy link

ghost commented May 4, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants