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

feat(terraform): iterator argument support for dynamic blocks #7235

Closed
nikpivkin opened this issue Jul 26, 2024 · 0 comments · Fixed by #7236
Closed

feat(terraform): iterator argument support for dynamic blocks #7235

nikpivkin opened this issue Jul 26, 2024 · 0 comments · Fixed by #7236
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning
Milestone

Comments

@nikpivkin
Copy link
Contributor

See documentation for details.

The iterator argument (optional) sets the name of a temporary variable that represents the current element of the complex value. If omitted, the name of the variable defaults to the label of the dynamic block ("setting" in the example above).

Now, using this argument can lead to false positives.

An example of the use of the iterator argument:

resource "aws_s3_bucket" "this" {
  dynamic versioning {
    for_each = ["true"]
    iterator = ver

    content {
      enabled = ver.value
    }
  } 
}

Which is equivalent to the following:

resource "aws_s3_bucket" "this" {
  dynamic versioning {
    for_each = ["true"]

    content {
      enabled = versioning.value
    }
  } 
}
@nikpivkin nikpivkin added kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning labels Jul 26, 2024
@nikpivkin nikpivkin self-assigned this Jul 26, 2024
@simar7 simar7 added this to the v0.55.0 milestone Aug 7, 2024
@simar7 simar7 self-assigned this Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants