Hi,
I’m writing a provider, and one of th resources has the following schema:
...
"location": {
Type: types.ObjectType{
AttrTypes: map[string]attr.Type{
"latitude": types.Float64Type,
"longitude": types.Float64Type,
"altitude": types.Float64Type,
"source": types.StringType,
},
},
Required: true,
},
...
When I try to create a resource I get the following error during the plan phase:
Provider "..." planned an invalid value for..: planned value
cty.ObjectVal(map[string]cty.Value{
"altitude":cty.NumberIntVal(0),
"latitude":cty.NumberFloatVal(48.12029),
"longitude":cty.NumberFloatVal(-1.63426),
"source":cty.StringVal("CONFIG")})
does not match config value
cty.ObjectVal(map[string]cty.Value{
"altitude":cty.NumberIntVal(0),
"latitude":cty.MustParseNumberVal("48.12029"),
"longitude":cty.MustParseNumberVal("-1.63426"),
"source":cty.StringVal("CONFIG")}).
The data is stored in this struct:
type ... struct {
...
Location types.Object `tfsdk:"location"`
...
}
I’m not sure where I went wrong and I can’t find anything on internet.