diff --git a/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go b/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go index fc1d6d6490..00d29b7295 100644 --- a/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go +++ b/datadog/fwprovider/resource_datadog_integration_cloudflare_account.go @@ -199,6 +199,10 @@ func (r *integrationCloudflareAccountResource) updateState(ctx context.Context, if name, ok := attributes.GetNameOk(); ok { state.Name = types.StringValue(*name) } + + if resources, ok := attributes.GetResourcesOk(); ok { + state.Resources, _ = types.ListValueFrom(ctx, types.StringType, resources) + } } func (r *integrationCloudflareAccountResource) buildIntegrationCloudflareAccountRequestBody(ctx context.Context, state *integrationCloudflareAccountModel) (*datadogV2.CloudflareAccountCreateRequest, diag.Diagnostics) { @@ -212,11 +216,8 @@ func (r *integrationCloudflareAccountResource) buildIntegrationCloudflareAccount attributes.SetName(state.Name.ValueString()) if !state.Resources.IsNull() { - resourceElements := state.Resources.Elements() - resources := make([]string, len(resourceElements)) - for i, resource := range resourceElements { - resources[i] = resource.(types.String).ValueString() - } + var resources []string + diags.Append(state.Resources.ElementsAs(ctx, &resources, false)...) attributes.SetResources(resources) } @@ -237,11 +238,8 @@ func (r *integrationCloudflareAccountResource) buildIntegrationCloudflareAccount } if !state.Resources.IsNull() { - resourceElements := state.Resources.Elements() - resources := make([]string, len(resourceElements)) - for i, resource := range resourceElements { - resources[i] = resource.(types.String).ValueString() - } + var resources []string + diags.Append(state.Resources.ElementsAs(ctx, &resources, false)...) attributes.SetResources(resources) }