diff --git a/internal/locality/regional/schemas.go b/internal/locality/regional/schemas.go index 29b5e196ad..e416d7583c 100644 --- a/internal/locality/regional/schemas.go +++ b/internal/locality/regional/schemas.go @@ -31,7 +31,11 @@ func Schema() *schema.Schema { Description: "The region you want to attach the resource to", Optional: true, ForceNew: true, - Computed: true, ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(allRegions(), "region"), + DiffSuppressFunc: suppressSDKNullAssignment, } } + +func suppressSDKNullAssignment(k, old, new string, d *schema.ResourceData) bool { + return new == "" && old != "" +} diff --git a/internal/locality/zonal/schemas.go b/internal/locality/zonal/schemas.go index 279a981e18..382519038d 100644 --- a/internal/locality/zonal/schemas.go +++ b/internal/locality/zonal/schemas.go @@ -31,7 +31,11 @@ func Schema() *schema.Schema { Description: "The zone you want to attach the resource to", Optional: true, ForceNew: true, - Computed: true, ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(AllZones(), "zone"), + DiffSuppressFunc: suppressSDKNullAssignment, } } + +func suppressSDKNullAssignment(k, old, new string, d *schema.ResourceData) bool { + return new == "" && old != "" +}