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

Recognise local references in dynamic blocks #1870

Open
1 task
anthonyma94 opened this issue Oct 25, 2024 · 1 comment
Open
1 task

Recognise local references in dynamic blocks #1870

anthonyma94 opened this issue Oct 25, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@anthonyma94
Copy link

anthonyma94 commented Oct 25, 2024

Extension Version

v2.33.0

VS Code Version

Version: 1.94.2 (system setup)
Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
Date: 2024-10-09T16:08:44.566Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

Operating System

WSL Ubuntu 24.04

Terraform Version

Terraform 1.8.4

Steps to Reproduce

locals {
  user_attributes = {
    email = {
      name                = "email"
      attribute_data_type = "String"
    }
    "selected_tenant" = {
      name                     = "custom:selected_tenant"
      attribute_data_type      = "String"
      developer_only_attribute = false
      mutable                  = true
      string_attribute_constraints = {
        max_length = 2048
        min_length = 0
      }
    }
  }
}

resource "aws_cognito_user_pool" "name" {
 ...
  dynamic "schema" {
    for_each = { for k, s in local.user_attributes : k => s }
    # no syntax highlighting or intellisense for schema
    #####################################################################
    content {
      attribute_data_type      = schema.value.attribute_data_type
      name                     = replace(schema.value.name, "custom:", "")
      developer_only_attribute = lookup(schema.value, "developer_only_attribute", null)
      mutable                  = lookup(schema.value, "mutable", null)
    }
  }
}

Expected Behavior

Not sure if it's supported, but having syntax highlighting and intellisense would be nice.

Actual Behavior

No syntax hightlighting or intellisense.

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

No response

Workarounds

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@anthonyma94 anthonyma94 added the bug Something isn't working label Oct 25, 2024
@dbanck
Copy link
Member

dbanck commented Oct 29, 2024

Hi @anthonyma94,

Thanks for the report. You're right, we don't currently recognise "local" references within the dynamic block, such as schema.* in your example. This affects completion, hover, go-to-* and semantic token highlighting.

What makes these local references different from other local references we already support (such as count.index, each.*, and self.*) is that apart from the first segment, such as schema above, the rest of the address is entirely dependent on interpolating the supplied expression/variable inside for_each.

I'll rename this as a feature request if you don't mind.

@dbanck dbanck added enhancement New feature or request and removed bug Something isn't working labels Oct 29, 2024
@dbanck dbanck changed the title Syntax highlighting and IntelliSense not working in for loops Recognise local references in dynamic blocks Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants