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

Nested dynamic blocks flagged as errors #1877

Open
1 task
ephraim-gr opened this issue Nov 13, 2024 · 4 comments
Open
1 task

Nested dynamic blocks flagged as errors #1877

ephraim-gr opened this issue Nov 13, 2024 · 4 comments
Labels
bug Something isn't working outdated-schema

Comments

@ephraim-gr
Copy link

ephraim-gr commented Nov 13, 2024

Extension Version

v2.33.0

VS Code Version

Version: 1.95.1
Commit: 65edc4939843c90c34d61f4ce11704f09d3e5cb6
Date: 2024-10-31T05:14:54.222Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin arm64 23.6.0

Operating System

macOS Sonoma 14.7.1 (23H222)

Terraform Version

Terraform v1.9.8 on darwin_arm64

Steps to Reproduce

Basically the same as #1594.
I specifically am trying to do this and get the same error Unexpected block: Blocks of type "dynamic" are not expected here:

dynamic "global_secondary_index" {
    for_each = var.global_secondary_indexes
    content {
      name               = global_secondary_index.key
      hash_key           = global_secondary_index.value.hash_key
      range_key          = global_secondary_index.value.range_key
      projection_type    = global_secondary_index.value.projection_type != null ? global_secondary_index.value.projection_type : global_secondary_index.value.non_key_attributes != null ? "INCLUDE" : "ALL"
      non_key_attributes = global_secondary_index.value.non_key_attributes
      read_capacity      = var.billing.mode == "PROVISIONED" ? global_secondary_index.value.read_capacity : null
      write_capacity     = var.billing.mode == "PROVISIONED" ? global_secondary_index.value.write_capacity : null
      dynamic "on_demand_throughput" {
        for_each = var.billing.mode == "PAY_PER_REQUEST" ? [var.billing] : []
        content {
          max_read_request_units  = on_demand_throughput.value.max_read_request_units
          max_write_request_units = on_demand_throughput.value.max_write_request_units
        }
      }
    }
  }

Expected Behavior

Shouldn't give me this error as it was fixed in version 2.29.0 as was stated in this comment

Actual Behavior

Still get the error

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
@ephraim-gr ephraim-gr added the bug Something isn't working label Nov 13, 2024
@dbanck
Copy link
Member

dbanck commented Nov 13, 2024

Hi @ephraim-gr,

Thanks for the report! To reproduce the issue, I need more information about your configuration. Which data/resource/provider has a global_secondary_index?

@dbanck dbanck changed the title Issue #1594 is still happening Nested dynamic blocks as errors flagged as errors Nov 13, 2024
@dbanck dbanck changed the title Nested dynamic blocks as errors flagged as errors Nested dynamic blocks flagged as errors Nov 13, 2024
@ephraim-gr
Copy link
Author

Hi @dbanck, thanks for the response.
I'm using aws dynamodb table resource

@dbanck
Copy link
Member

dbanck commented Nov 14, 2024

Thanks! I was able to reproduce the error you're seeing.

on_demand_throughput was added to the AWS provider in 5.72.0. The latest version of the language server shipped with version 5.71.0, so it doesn't know about the new block yet.

We bundle the latest provider schema available at the time of the language server and extension release. If new attributes, blocks or resources are introduced since then, we can't automatically reflect them (yet). The next language server release will bundle the updated schema and fix the problem. We apologize for the inconvenience.

In the meantime, when you run terraform init, we'll use the appropriate provider schema from disk.

In case you want to learn more about how we handle provider schemes, we have an explainer here: https://github.com/hashicorp/terraform-ls/blob/main/docs/schema.md

@ephraim-gr
Copy link
Author

Got it, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working outdated-schema
Projects
None yet
Development

No branches or pull requests

2 participants