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

Using self.ATTRIBUTE where you shouldn't causes a panic #4808

Closed
dlanger opened this issue Jan 24, 2016 · 2 comments · Fixed by #5273
Closed

Using self.ATTRIBUTE where you shouldn't causes a panic #4808

dlanger opened this issue Jan 24, 2016 · 2 comments · Fixed by #5273

Comments

@dlanger
Copy link

dlanger commented Jan 24, 2016

➜ dan-xub2 /space/terratry/cos terraform --version
Terraform v0.6.9

Because I only skimmed the docs, I assumed you could use self.ATTRIBUTE anywhere it looked right - like this:

module "public_subnets" {
  source = "github.com/terraform-community-modules/tf_aws_public_subnet"
  name = "${var.service}-public"
  cidrs = "${lookup(var.subnet_assignments, self.name)}"
}

This causes a Go panic - crash.log here.

Having read the docs again, I see that this shouldn't work here ("To reference attributes of your own resource, the syntax is self.ATTRIBUTE...Note that this is only allowed/valid within provisioners."), but I'd expect it to fail more gracefully.

@dlanger dlanger changed the title Using self.name where you shouldn't causes a panic Using self.ATTRIBUTE where you shouldn't causes a panic Jan 24, 2016
@dlanger
Copy link
Author

dlanger commented Jan 24, 2016

Similar panic if I used something which didn't exist, like self.cats (as opposed to self.name).

@ghost
Copy link

ghost commented Apr 28, 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 Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants