Skip to content

Dynamic Block causing Unexpected Block: Blocks of type "dynamic" are not expected here. #1930

@michaelrichards-cosmo

Description

@michaelrichards-cosmo

Extension Version

v2.34.2

VS Code Version

Version: 1.96.2 (user setup)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

Operating System

Windows 11 Enterprise version 23H2

Terraform Version

Terraform v1.10.3 on Windows_386

Steps to Reproduce

Main.TF

resource "azurerm_dev_center" "adc" {
name = lower("adc-${var.environment}-${var.solution_name}-${var.location}-${var.instance_number}")
resource_group_name = var.resource_group_name
location = var.location
}

#Dynamic creation of projects
dynamic "project" {
for_each = var.projects
content {
resource "azurerm_dev_center_project" "example" {
name = project.value.name
dev_center_id = azurerm_dev_center.example.id
description = project.value.description
}
}
}

Variables TF:

variable "projects" {
description = "List of projects"
type = list(object({
name = string
description = string
}))
}

Expected Behavior

This is valid syntax. I wouldn't expect the dynamic block to be throwing the error

Actual Behavior

In the Main.TF, IntelliSense indicating: Unexpected Block: Blocks of type "dynamic" are not expected here.

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

No response

Workarounds

No response

References

Similar to 1594 and 1877

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions