Hey there @OrNovo thanks for posting and sorry you’re running into trouble here,
Addressing the error
Based on that error message, I’m assuming that you have a data model that looks something like:
type ResourceModel struct {
// other `tfsdk` fields
Applications *coralogix.TCORuleModel `tfsdk:"applications"`
}
type TCORuleModel struct {
// other `tfsdk` fields
}
The error you’re running into is a result of Go structs not having a concept of Unknown
, so when plugin framework receives an Unknown
value from Terraform core, it returns a diagnostic because it can’t convert Unknown
into the TCORuleModel
struct. The fix would be to switch to the plugin framework types.Object
type:
type ResourceModel struct {
// other `tfsdk` fields
Applications types.Object `tfsdk:"applications"`
}
type TCORuleModel struct {
// other `tfsdk` fields
}
You can see some examples of accessing/setting types.Object
values in our recently revamped documentation:
Terraform Core behavior
I don’t have a background on why Terraform core considers the local.test[count.index]
expression as unknown, regardless, our recommendation is to always use the built-in framework types to stay in-line with Terraforms type system concepts.
Perhaps @jbardin or someone from the Terraform core team could expand on why that expression is unknown.