hashicorp / vscode-terraform

HashiCorp Terraform VSCode extension
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
Mozilla Public License 2.0
911 stars 180 forks source link

"tags" not expected in `aws_budgets_budget` #1764

Closed jwavoet closed 4 weeks ago

jwavoet commented 1 month ago

Extension Version

v.2.30.1

VS Code Version

Version: 1.89.1 (Universal) Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:14:24.611Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 23.5.0

Operating System

macOS Sonoma Version 14.5 (23F79)

Terraform Version

Terraform v1.7.4 on darwin_arm64

Steps to Reproduce

  1. Create resource "aws_budgets_budget" "this" {}
  2. Add tags = {}

Expected Behavior

This should be allowed

Actual Behavior

Unexpected attribute: An attribute named "tags" is not expected here

Terraform Configuration

resource "aws_budgets_budget" "this" {
  name              = var.client
  budget_type       = "COST"
  limit_amount      = local.total_costs
  limit_unit        = "USD"
  time_unit         = "MONTHLY"

  cost_filter {
    name = "TagKeyValue"
    values = [
      "Client${"$"}${var.client}",
    ]
  }

  cost_types {
    use_amortized = true
    include_tax   = false
  }

  notification {
    comparison_operator        = "GREATER_THAN"
    threshold                  = 100
    threshold_type             = "PERCENTAGE"
    notification_type          = "FORECASTED"
    subscriber_email_addresses = []
  }

  tags = {
    Environment = var.env
    Terraform   = true
    Client      = var.client
    Application = var.application
  }
}

Project Structure

N/A

Gist

No response

Anything Else?

Terraform apply works fine, having tags in this resources is allowed since aws provider version 5.50.0 and higher.

Workarounds

Ignore error

References

No response

Help Wanted

Community Note

dbanck commented 1 month ago

Hi @jwavoet, thanks for the report.

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.

dbanck commented 4 weeks ago

@jwavoet We have released a new version 2.30.2. This updates the schema to the latest version and should fix the validation error. The update should show up automatically in VS Code.


If you experience any other validation related bug, please let us know via a new issue.