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

count.index*32: unknown count type: 0x0 #2046

Closed
Fodoj opened this issue May 22, 2015 · 9 comments · Fixed by #2505
Closed

count.index*32: unknown count type: 0x0 #2046

Fodoj opened this issue May 22, 2015 · 9 comments · Fixed by #2505
Assignees

Comments

@Fodoj
Copy link

Fodoj commented May 22, 2015

cidr_block = "${concat("10.0.0.", count.index*32, "/2")}" => count.index*32: unknown count type: 0x0

What could be the issue here?

@Fodoj Fodoj changed the title count.index**32: unknown count type: 0x0 count.index*32: unknown count type: 0x0 May 22, 2015
@phinze
Copy link
Contributor

phinze commented May 22, 2015

Interesting. Looks like a parsing bug. If you space out the math it works!

resource "aws_subnet" "foo" {
  count = "3"
  cidr_block = "${concat("10.0.0.", count.index * 32, "/2")}"
}

Tagged and we'll get this fixed.

@Fodoj
Copy link
Author

Fodoj commented May 22, 2015

Thanks! If you need help fixing it, just point me into right direction and I will prepare PR in next few days

@Fodoj
Copy link
Author

Fodoj commented May 26, 2015

@mitchellh @phinze another bug:

#{128 + count.index * 32} => 4096

I'd like to get it fixed, should I take a look at github.com/hashicorp/terraform/config/lang/ast? Which other components are involved?

@mitchellh
Copy link
Contributor

@Fodoj What is the bug there? Our language doesn't do order of ops on its own (all operator precedence is the same). Wrap things in parens to get the order you want.

@Fodoj
Copy link
Author

Fodoj commented Jun 8, 2015

@mitchellh I would normally expect basic math operations to function as they always do. So that kind of operator precedence is totally unexpected and feels unusual at least.

@mitchellh
Copy link
Contributor

@Fodoj If you'd like to add precedence that's fine with me, in that case

@Fodoj
Copy link
Author

Fodoj commented Jun 8, 2015

@mitchellh sure. Could you point me into required types in codebase? that's mostly related to ast code, right?

@mitchellh
Copy link
Contributor

Precedence should just be the parser code, the YACC syntax (.y) in the config/lang directory.

@ghost
Copy link

ghost commented May 2, 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 2, 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.

3 participants