Skip to content

Commit 87f9a1d

Browse files
committed
fix code
1 parent c01889f commit 87f9a1d

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

internal/locality/dsf.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package locality
2+
3+
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
4+
5+
func SuppressSDKNullAssignment(k, old, new string, d *schema.ResourceData) bool {
6+
return (new == "" && old != "") || (new != "" && old == "")
7+
}

internal/locality/regional/schemas.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ func Schema() *schema.Schema {
3232
Optional: true,
3333
ForceNew: true,
3434
ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(allRegions(), "region"),
35-
DiffSuppressFunc: suppressSDKNullAssignment,
35+
DiffSuppressFunc: locality.SuppressSDKNullAssignment,
3636
}
3737
}
38-
39-
func suppressSDKNullAssignment(k, old, new string, d *schema.ResourceData) bool {
40-
return new == "" && old != ""
41-
}

internal/locality/zonal/schemas.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ func Schema() *schema.Schema {
3232
Optional: true,
3333
ForceNew: true,
3434
ValidateDiagFunc: locality.ValidateStringInSliceWithWarning(AllZones(), "zone"),
35-
DiffSuppressFunc: suppressSDKNullAssignment,
35+
DiffSuppressFunc: locality.SuppressSDKNullAssignment,
3636
}
3737
}
38-
39-
func suppressSDKNullAssignment(k, old, new string, d *schema.ResourceData) bool {
40-
return new == "" && old != ""
41-
}

0 commit comments

Comments
 (0)