hashicorp / hashicorp/terraform-plugin-framework

ListNestedAttribute can't be set to Computed in Resource

Open
#1,104 2 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
384
Forks
107
Avg merge
3m
Merged PRs (30d)
1

Description

### Module version

```
github.com/hashicorp/terraform-plugin-framework v1.14.1
```

### Relevant provider source code

```go
type parentObject struct {
someFields....
ListNested []nestedObjectModel `tfsdk:"nestedList"`
```
```go
"nestedList": schema.ListNestedAttribute{
Computed: true, <----- PROBLEM
NestedObject: schema.NestedAttributeObject{
Attributes: getNestedObjectSchema(),
},
},
```

### Expected Behavior
The nestedList field should behave exactly like in the datasource.

### Actual Behavior
An error is thrown:
```
____.go:222: Step 1/2 error: Error running apply: exit status 1

Error: Value Conversion Error

with ___.___,
on terraform_plugin_test.tf line 12, in resource "____" "_____":
12: resource "______" "________" {

An unexpected error was encountered trying to build a value. This is always
an error in the provider. Please report the following to the provider
developer:

Received unknown value, however the target type cannot handle unknown values.
Use the corresponding `types` package type or a custom type that handles
unknown values.

Path: nestedList
Target Type: []provider.nestedObjectModel
Suggested Type: basetypes.ListValue

```

### Steps to Reproduce
Try to mark a listNestedAttribute, as computed...
### References

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.