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

Incorrect behavior | Unexpected attribute: An attribute named "auto_apply_run_trigger" is not expected hereTerraform #1649

Closed
1 task
geglne opened this issue Dec 8, 2023 · 3 comments

Comments

@geglne
Copy link

geglne commented Dec 8, 2023

Extension Version

= v2.28.0

VS Code Version

Version: 1.84.2 (system setup)
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:51:52.184Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045

Operating System

Edition Windows 10 Enterprise Version 22H2 Installed on ‎11/‎24/‎2022 OS build 19045.3693

Terraform Version

Terraform v1.6.4 on windows_amd64

Steps to Reproduce

With the following block:

resource "tfe_workspace" "workspace" {
  name                   = var.name
  description            = var.description
  organization           = var.organization_name
  auto_apply             = var.auto_apply
  auto_apply_run_trigger = var.auto_apply_run_trigger
  file_triggers_enabled  = var.file_triggers_enabled
  execution_mode         = var.execution_mode
  terraform_version      = var.terraform_version
  working_directory      = var.working_directory
  trigger_patterns       = var.vcs_trigger_patterns
  dynamic "vcs_repo" {
    for_each = var.vcs_repo_name != "" ? [var.vcs_repo_name] : []
    content {
      identifier     = "${var.vcs_repo_organization_name}/${var.vcs_repo_name}"
      oauth_token_id = sensitive(data.tfe_oauth_client.client.oauth_token_id)
      branch         = var.vcs_default_branch
    }
  }
}

A "Problem" exists with the attribute auto_apply_run_trigger = var.auto_apply_run_trigger and the output of the message when I hover over it is: Unexpected attribute: An attribute named "auto_apply_run_trigger" is not expected here Terraform:

image

When I roll the extension back to v2.27.2 this problem does not exist. It looks like v2.28.0 introduced this bug, maybe:

image

(I do see that the var still doesn't resolve as the others, but I don't get the red squiggly anymore)

Expected Behavior

Something similar to the second screen shot above.

As noted above, the var designator as a different color from the rest of them. Not sure what it implies, but it "feels" irregular?

Actual Behavior

The first screenshot with the red squiggly under the line with the auto_apply_run_trigger attribute

Terraform Configuration

No response

Project Structure

.
|--_modules
|  |--team
|  |--team_members
|  |--workspace
      |--outputs.tf
      |--resource.tf
      |--variables.tf

The block of code from above is in the `resource.tf` file. The `outputs.tf` and `variables.tf` should be evident by their names.

Gist

N/A

Anything Else?

I have turned off all other Terraform extensions and isolated it to (spot checked, only) any version>= v2.28.0 as far as I can tell.

Workarounds

Rollback the extension to v2.27.2 for now.

References

I did a search for the attribute name and couldn't find anything related that was open.

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
@geglne geglne added the bug Something isn't working label Dec 8, 2023
@radeksimko radeksimko added question and removed bug Something isn't working labels Dec 8, 2023
@radeksimko
Copy link
Member

Hi @geglne
The mentioned attribute was added to the provider relatively recently in v0.50.0.

Since we only bundle a single version of the tfe provider schema in the language server, we cannot provide the level of accuracy out of the box currently.

The good news is however that if you run terraform init to install the latest version of the provider (assuming you have the appropriate version constraint that matches 0.50.0), the extension will pick it up and use that schema to do the validation.

We plan to improve the experience in similar situations by eventually pulling the schema from the Registry API but this is a non-trivial project that will take some time to execute. You can follow #737 in the meantime.

@dbanck
Copy link
Member

dbanck commented Dec 13, 2023

@geglne We just released a new version 2.29.1. This updates the schema to the latest version and should fix the validation error. The update should appear automatically in VS Code.


In case you experience any different validation related bug, please do let us know through a new issue.

@dbanck dbanck closed this as completed Dec 13, 2023
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants