hashicorp / hashicorp/terraform-plugin-framework

Handle Nested Attributes and Nested Blocks Using List, Set and Map When Validating Attribute Field Names

Open
#574 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
384
Forks
107
Avg merge
3m
Merged PRs (30d)
1

Description

### Module version
```
v0.17
```

### Use-cases

```go
for k, v := range attributes {
d := validateAttributeFieldName(path.AtName(k), k, v)
```

```go
for k, v := range blocks {
d := validateBlockFieldName(path.AtName(k), k, v)
```

Since the nested attributes might be done using list, map, or set mode, we'll also need to account for adding those intermediate steps (AtListIndex, AtMapKey, AtSetValue) to the path.

### Attempted Solutions

N/A

### Proposal

Fix up the path information and consider including it in the diagnostic details in case it is not in Terraform's output. Maybe we can use something like the zero-value (e.g. AtListIndex(0), AtMapKey(""), AtSetValue(/* ? */)) for describing those intermediate path steps for static validation.

### References

- #136
- #548

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.