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

No variable named "count". #29

Closed
tomasaschan opened this issue Sep 25, 2019 · 5 comments
Closed

No variable named "count". #29

tomasaschan opened this issue Sep 25, 2019 · 5 comments

Comments

@tomasaschan
Copy link

The following config yields an error as indicated by the comment:

resource "random_string" "foo" {
  count  = 3
  length = 10
}

resource "random_string" "bar" {
  count  = 3
  length = 10
  keepers = {
    foo = random_string.foo[count.index].result # squigglies under "count"
  }
}

There is no variable named "count".Terraform Schema

@j0nathontayl0r
Copy link

j0nathontayl0r commented Sep 29, 2019

Similar issue found with for-each loops.

variable "bar" {
  description                           = "A map of the ARN objects"
  default                               = {
    SuperAdmin-Role-AWS                 = "arn:aws:iam::bar:role/Some-SA-Role,arn:aws:iam::bar:saml-provider/Some-IdP-SA"
    ReadOnly-Role-AWS                   = "arn:aws:iam::bar:role/Some-RO-Role,arn:aws:iam::bar:saml-provider/Some-IdP-RO"
}

resource okta_app_saml foo {
  for_each                              = var.bar
  label                                 = each.key
  sso_url                               = "https://signin.aws.amazon.com/saml"
  recipient                             = "https://signin.aws.amazon.com/saml"
  destination                           = "https://signin.aws.amazon.com/saml"
  audience                              = "https://signin.aws.amazon.com/saml"
}

Error reads:

There is no variable named "each". Did you mean "path"?

@endzyme
Copy link
Contributor

endzyme commented Nov 26, 2019

Hi all! If anyone is available to help test this out, I did get this working locally with vscode but would some other testers in the wild for this change (PR #43)

@Kasama
Copy link

Kasama commented Nov 26, 2019

worked fine for me (on vim), it does not suggest the .index part, but does not throw an error on count.index anymore

@endzyme
Copy link
Contributor

endzyme commented Nov 26, 2019

@Kasama - just to clarify: Did it used to suggest count.index? (I'm curious if my change introduced a regression)

@Kasama
Copy link

Kasama commented Nov 26, 2019

No, it didn't. It's just something that - although much harder to do - I expected to work. I'm not even sure if it really should, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants