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

odata.type is not recognised by the extension #41

Open
2 tasks done
kai-nguyen-aligent opened this issue Jan 18, 2023 · 0 comments
Open
2 tasks done

odata.type is not recognised by the extension #41

kai-nguyen-aligent opened this issue Jan 18, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kai-nguyen-aligent
Copy link

Versions

This bug is reproducible in:

  • the latest version of the extension (below)
  • the latest version of the language server (below)

Extension

HashiCorp Terraform v2.25.2

Language Server

terraform-ls v1.2.0

VS Code

Version: 1.74.3
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T16:57:40.428Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.14.0-1055-oem
Sandboxed: No

Operating System

Ubuntu 20.04.5 LTS

Terraform Version

Terraform v1.3.0 on linux_amd64

Steps To Reproduce

  1. Go to main.tf
  2. Add a azapi_resource
  3. Under body.properties.criteria, add odata.type
  4. Notice that VSCode still complains odata.type is required, but no definition was found even though the property is there.

Include any relevant Terraform configuration or project structure:

resource "azapi_resource" "exception_alerts_windows" {
  type      = "Microsoft.Insights/metricAlerts@2018-03-01"
  name      = "${var.metric_alerts_prefix}-${var.project}-${var.environment}-exception-alerts-windows"
  location  = var.metric_alerts_location
  parent_id = azurerm_resource_group.resource_group.id
  body = jsonencode({
    properties = {
      description         = "Action will be triggered when there is an exception in function app"
      severity            = 0 // Critical (from 0 as Critical to 4 as Verbose)
      enabled             = true
      scopes              = [azurerm_application_insights.application_insights_windows.id]
      evaluationFrequency = "PT1M" 
      windowSize          = "PT5M"
      criteria = {
        odata.type = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"
        allOf = [
          {
            criterionType   = "StaticThresholdCriterion"
            metricName      = "exceptions/server"
            metricNamespace = "microsoft.insights/components"
            name            = "Metric1"
            operator        = "GreaterThanOrEqual"
            threshold       = 1
            timeAggregation = "Count"
          }
        ]
      }
      autoMitigate         = false
      targetResourceRegion = azurerm_resource_group.resource_group.location
      targetResourceType   = "microsoft.insights/components"
      actions = [
        {
          actionGroupId     = azurerm_monitor_action_group.action_group.id
          webHookProperties = {}
        }
      ]
    }
  })

# etc...

Expected Behavior

VSCode should not complain about missing odata.type

Actual Behavior

VSCode complaint that odata.type is missing.

Additional context

  • I'm running Terraform from a Docker container.
  • I tried with few different way to denote odata.type, none of them fix the issue:
  • Raw string: odata.type
  • With brackets: (odata.type)
  • With quotes: "odata.type"
  • If I declare odata.type without quote as shown in the example above, I will not be able to deploy due to an error: A managed resource "odata" "type" has not been declared in the root module.
@kai-nguyen-aligent kai-nguyen-aligent added the bug Something isn't working label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant