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

Terraform can't find some resources when they are created using resource count parameter #431

Closed
albertsj1 opened this issue Oct 16, 2014 · 6 comments

Comments

@albertsj1
Copy link

This is somewhat related to #430. The dependency order was incorrect, so I modified many of the resources to specify directly the dependencies using the 'depends_on' resource parameter. Terraform started creating things in the expected order; however, it was unable to locate some resources it had just created that needed to be used in later resources. For example, it was unable to determine the subnet id for a subnet that it had just created.

aws_subnet.public.1: Creating...
  availability_zone: "" => "us-west-2b"
  cidr_block:        "" => "10.20.1.0/24"
  vpc_id:            "" => "vpc-122fe577"
aws_subnet.public.1: Creation complete
--- snip ---
aws_instance.nat.1: Creating...
  ami:                         "" => "ami-bb69128b"
  associate_public_ip_address: "" => "1"
  availability_zone:           "" => "us-west-2b"
  instance_type:               "" => "m1.small"
  key_name:                    "" => "john"
  private_dns:                 "" => "<computed>"
  private_ip:                  "" => "<computed>"
  public_dns:                  "" => "<computed>"
  public_ip:                   "" => "<computed>"
  security_groups.#:           "" => "1"
  security_groups.0:           "" => "${aws_security_group.nat.1.id}"
  source_dest_check:           "" => "0"
  subnet_id:                   "" => "${aws_subnet.public.1.id}"
--- snip ---
aws_instance.nat.1: Error: Error launching source instance: The subnet ID '${aws_subnet.public.1.id}' does not exist (InvalidSubnetID.NotFound)

The full configuration as well as output is available in this gist.

@mitchellh
Copy link
Contributor

That double-interpolation is not supposed to work properly. We should turn that into a syntax error: ${foo.${bar}.baz}.

@mitchellh
Copy link
Contributor

Done

@albertsj1
Copy link
Author

By 'done' do you mean Terraform now generates an error message, or you've added the ability to use double interpolation?

@mitchellh
Copy link
Contributor

Heh, sorry. It generates a proper error message. There are a couple issues you might want to track to get the behavior you wanted: #219 and... I can't find another. But that would help.

@albertsj1
Copy link
Author

I'm glad it generates an error now. That greatly helps with learning and
debugging. Thanks for adding the error messages.
On Feb 17, 2015 3:50 PM, "Mitchell Hashimoto" notifications@github.com
wrote:

Heh, sorry. It generates a proper error message. There are a couple issues
you might want to track to get the behavior you wanted: #219
#219 and... I can't find
another. But that would help.


Reply to this email directly or view it on GitHub
#431 (comment).

@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

2 participants