Skip to content

Commit 9f00a27

Browse files
Check batching attributes in framework defaults (#7642) (#14235)
Signed-off-by: Modular Magician <[email protected]>
1 parent c8ccabc commit 9f00a27

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.changelog/7642.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
provider: fixed an issue where the provider crashed when "batching" was set in `4.60.0`/`4.60.1`
3+
```

google/framework_config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (p *frameworkProvider) HandleDefaults(ctx context.Context, data *ProviderMo
249249
pbConfigs[0].EnableBatching = types.BoolValue(true)
250250
}
251251

252-
data.Batching, d = types.ListValueFrom(ctx, types.ObjectType{}, pbConfigs)
252+
data.Batching, d = types.ListValueFrom(ctx, types.ObjectType{}.WithAttributeTypes(ProviderBatchingAttributes), pbConfigs)
253253
}
254254

255255
if data.UserProjectOverride.IsNull() && os.Getenv("USER_PROJECT_OVERRIDE") != "" {

google/provider_model.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package google
22

33
import (
4+
"github.com/hashicorp/terraform-plugin-framework/attr"
45
"github.com/hashicorp/terraform-plugin-framework/types"
56
)
67

@@ -141,6 +142,11 @@ type ProviderBatching struct {
141142
EnableBatching types.Bool `tfsdk:"enable_batching"`
142143
}
143144

145+
var ProviderBatchingAttributes = map[string]attr.Type{
146+
"send_after": types.StringType,
147+
"enable_batching": types.BoolType,
148+
}
149+
144150
// ProviderMetaModel describes the provider meta model
145151
type ProviderMetaModel struct {
146152
ModuleName types.String `tfsdk:"module_name"`

0 commit comments

Comments
 (0)