resource "aws_vpc" "vpc" {
cidr_block = "10.10.0.0/16"
}
resource "aws_subnet" "subnet" {
count = 3
vpc_id = aws_vpc.vpc.id
cidr_block = "10.10.${count.index + 1}.0/24"
availability_zone_id = "apse2-az${count.index + 1}"
}
In the following HCL count (both instances) is marked as There is no variable named "count".
Having this issue on language server 0.9 too.
Same here on HCL2 and language server v0.0.9:
resource "aws_iam_role_policy_attachment" "this" {
count = length(var.policy_arns)
role = aws_iam_role.this.name
policy_arn = var.policy_arns[count.index]
}
VSCode problems console shows: There is no variable names "count"
As if it doesn't treat 'count' as special word and looks for a variable definition
@zachovich
Not sure if this is your issue but from reading the Terraform docs it looks like count is not a supported argument for aws_iam_role_policy_attachment.
https://www.terraform.io/docs/providers/aws/r/iam_role_policy_attachment.html#argument-reference
@audricganser https://www.terraform.io/docs/configuration/resources.html#count-multiple-resource-instances-by-count
I was just reading about meta-arguments and yes I suppose it should be able to handle count.
It's my first time helping out on a project like this 😄 . Thanks for the link.
having the same issue after tf upgrade to the version 12. Any progress here for a solution? Thanks!
There is already a Pull Request pending, which will fix this issue in the language server: https://github.com/juliosueiras/terraform-lsp/pull/43
@DJAlPee great, thx :) It seems as the PR has been merged yesterday
Just wondering are folks still experiencing this issue? I am still getting the count error. Do I need to update something or is the fix still pending? Thanks for the help 🙂
@mauve any chance you could release a new version including this change from lsp? 🙏
We just released v2.0.0-rc.1 of the extension. The main features include:
You can find additional information and specifics in the release notes and CHANGELOG.
With this release we expect that many of the prior issues and PRs are no longer relevant or have been addressed, and are therefore being closed. If you feel the action taken on an issue or PR is in error, please comment as such and we can figure out the appropriate way to address it.
We plan to add the final 2.0.0 release to the marketplace soon, but are actively seeking your feedback now on the release candidates. You can download the .vsix from the releases page and manually install it in VS Code to try it out.
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 context necessary to investigate further.
Most helpful comment
@DJAlPee great, thx :) It seems as the PR has been merged yesterday