hashicorp / hashicorp/vscode-terraform

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

Open
#2,003 0 comments 13 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
975
Forks
196
Avg merge
2h 47m
Merged PRs (30d)
1

Description

### Extension Version

v2.34.1

### VS Code Version

Version : v1.11.2

### Operating System

Windows 11

### Terraform Version

v1.11.2 amd64

### Steps to Reproduce

```
resource "google_secret_manager_secret_version" "my_secret_version" {
for_each = toset(var.secret_keys)
secret = google_secret_manager_secret.my_secret[each.value].id
secret_data_wo = var.secret_values[each.value]
}
```

will show the error

- `Unexpected attribute: An attribute named "secret_data_wo" is not expected here`
- `Required attribute "secret_data" not specified: An attribute named "secret_data" is required here`

### Expected Behavior

this is not the error

### Actual Behavior

show the unexpected error

### Terraform Configuration

```terraform
resource "google_secret_manager_secret" "my_secret" {
for_each = toset(var.secret_keys)
secret_id = each.value

replication {
user_managed {
replicas {
location = var.region
}
}
}
}

resource "google_secret_manager_secret_version" "my_secret_version" {
for_each = toset(var.secret_keys)
secret = google_secret_manager_secret.my_secret[each.value].id
secret_data_wo = var.secret_values[each.value]
}
```

### Project Structure

```sh

```

### 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](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) 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

Contributor guide

Open the contributing guide

Research direction

Start with the Terraform configuration in the Steps to Reproduce and reproduce the diagnostic in the VS Code extension using the listed versions. Identify where this resource's attributes are validated, then confirm that secret_data_wo is accepted without the unexpected-attribute or missing-secret_data errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.