Skip to content

Commit

Permalink
Merge pull request #4019 from grounded042/zone-type-verif-key
Browse files Browse the repository at this point in the history
fix: mark verification key as computed when changing to or from partial zone type
  • Loading branch information
jacobbednarz authored Oct 15, 2024
2 parents 8b62b82 + 725005d commit 5cda265
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/4019.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/cloudflare_zone: When changing `type` to or from `partial` the `verification_key` attribute will properly show that it will receive a new value.
```
12 changes: 11 additions & 1 deletion internal/sdkv2provider/resource_cloudflare_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/cloudflare/terraform-provider-cloudflare/internal/consts"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -91,7 +92,16 @@ var ratePlans = map[string]subscriptionData{

func resourceCloudflareZone() *schema.Resource {
return &schema.Resource{
Schema: resourceCloudflareZoneSchema(),
Schema: resourceCloudflareZoneSchema(),
CustomizeDiff: customdiff.All(
customdiff.ComputedIf("verification_key", func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool {
if d.HasChange("type") {
oldTypeVal, newTypeVal := d.GetChange("type")
return oldTypeVal == "partial" || newTypeVal == "partial"
}
return false
}),
),
CreateContext: resourceCloudflareZoneCreate,
ReadContext: resourceCloudflareZoneRead,
UpdateContext: resourceCloudflareZoneUpdate,
Expand Down

0 comments on commit 5cda265

Please sign in to comment.