Skip to content

ListNestedAttribute can't be set to Computed in Resource #1104

Open
@tom-ludwig

Description

@tom-ludwig

Module version

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

Relevant provider source code

type parentObject struct {
     someFields....
     ListNested []nestedObjectModel `tfsdk:"nestedList"`
			"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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions