Hi @KnockOutEZ
Sorry you ran into trouble here.
The issue is that the type you have specified for the Aws
field in the ClusterDetails
struct cannot handle null values.
The most straightforward fix is to alter the ClusterDetails
struct as follows:
type ClusterDetails struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
Aws types.Object `tfsdk:"aws"`
}
Further discussion of an analogous issue can be found in the following post - How count.index works - #2 by austin.valle
Assuming you are using something along the following lines within, for example, a Create
method:
var data ClusterDetails
diags := req.Plan.Get(ctx, &data)
resp.Diagnostics.Append(diags...)
/* ... */
You should then be able to convert the value contained within data.Aws
into an AWS
struct by using data.Aws.ObjectAs()
. Refer to Plugin Development - Framework: Object Type | Terraform | HashiCorp Developer for further information on data handling for objects.