Hi there,
I’m developing a new TF provider, and in the Schemas documentation I didn’t find a way to define a block like this:
data "myprovider_foo" "example" {
foo {
a = "one"
b = "two"
}
}
The only documentation I found for Blocks is in the Migrating from SDK - Blocks, but then, I cannot define a nested Map like this:
data "myprovider_foo" "example" {
foo {
alpha = {
a = "one"
b = "two"
}
beta = {
a = "three"
b = "four"
}
...
}
}
The only working solution I found is this:
func (d *MyDataSource) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) {
return tfsdk.Schema{
Attributes: map[string]tfsdk.Attribute{
"foo": {
Optional: true,
Attributes: tfsdk.MapNestedAttributes(map[string]tfsdk.Attribute{
"a": {
Type: types.StringType,
Optional: true,
},
"b": {
Type: types.StringType,
Optional: true,
},
}),
},
},
...
and to use it:
data "myprovider_foo" "example" {
foo = { <-- REQUIRES an `=` character
alpha = {
a = "one"
b = "two"
}
beta = {
a = "three"
b = "four"
}
...
}
}
Question: Is the Block deprecated with the TF Plugin Framework, and for new TF providers, should we favor more tfsdk.MapNestedAttributes() instead?