-
Notifications
You must be signed in to change notification settings - Fork 69
Invalid Count Argument #38
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
Comments
The VPC module is just included as an example for VPC creation if you don't have one already - if you do (and it looks like you do as you've inserted your values there), you can just remove the |
Thank you Pete, that did work. I don't think I setup the subnets correctly, though (I didn't put them in different availability zones, for example) so I ran into other issues. I want to start from scratch, so I deleted the manually created VPC, deleted all cached Terraform files and re-ran Terraform with just the *_VPC module with the intent of letting Terraform create the VPC for me, but I get the same count argument errors that I noted above. I do have a default VPC in the us-west-1 region, could that be causing a conflict? |
No I think I've actually just written that VPC module quite poorly, The errors are because I'm creating a specific number of resources based on a value that Terraform can't work out in advance. It seems that older versions used to be a bit more tolerant of this but now it just throws a hard error. It comes from the fact that easy region has a variable number of availability zones, at least two but sometimes five. What I tried to do there was query the number of zones and then create as many as needed, hence the count resource. Basically I just need to rewrite that with a better method. TL;DR though, I'd just create your fresh VPC and availability zones manually and plug the values back in until I fix that up. You only really need one AZ for this but two is good practice if you ever plan to deploy anything else in future :) |
Okay, thank you for your input! I will get this closed out. |
Hi there! Very new to Terraform. Any advice is appreciated.
Error message:

Main.tf 1 - Account ID Hidden

Main.tf 2

VPC:

Subnets:

Provider.tf:

Thank you! Really enjoying working on this.
The text was updated successfully, but these errors were encountered: