hashicorp / hashicorp/terraform-plugin-framework

`Plan` and `State` `SetAttribute` methods do not support setting an untyped nil value

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

Description

### Module version

```console
% go list -m github.com/hashicorp/terraform-plugin-framework/...
github.com/hashicorp/terraform-plugin-framework v0.1.0
```

### Actual Behavior

The [`Plan.SetAttribute`](https://github.com/hashicorp/terraform-plugin-framework/blob/1a7927fec93459115be87f283dd1ee7941b30578/tfsdk/plan.go#L62) and [`State.SetAttribute`](https://github.com/hashicorp/terraform-plugin-framework/blob/1a7927fec93459115be87f283dd1ee7941b30578/tfsdk/state.go#L65) methods do not currently support setting a _Null_ value via `state.SetAttribute(ctx, path, nil)`. I get the error

```
error setting value at AttributeName("identifier"): error creating new state value: don't know how to construct attr.Type from (invalid)
```

### Expected Behavior

To be able to set a _Null_ value (of the type specified at `path`) in `State` (and `Plan`, although I am not currently concerned with that case).

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.