Skip to content

Commit 26cea01

Browse files
authored
fix diff suppression for resource quantities in pv and pvc (#1145)
1 parent 1a5d859 commit 26cea01

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

kubernetes/resource_kubernetes_persistent_volume.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ func resourceKubernetesPersistentVolume() *schema.Resource {
9696
Set: schema.HashString,
9797
},
9898
"capacity": {
99-
Type: schema.TypeMap,
100-
Description: "A description of the persistent volume's resources and capacity. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#capacity",
101-
Required: true,
102-
Elem: schema.TypeString,
103-
ValidateFunc: validateResourceList,
99+
Type: schema.TypeMap,
100+
Description: "A description of the persistent volume's resources and capacity. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#capacity",
101+
Required: true,
102+
Elem: schema.TypeString,
103+
ValidateFunc: validateResourceList,
104+
DiffSuppressFunc: suppressEquivalentResourceQuantity,
104105
},
105106
"persistent_volume_reclaim_policy": {
106107
Type: schema.TypeString,

kubernetes/schema_persistent_volume_claim.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,18 @@ func persistentVolumeClaimSpecFields() map[string]*schema.Schema {
4545
Elem: &schema.Resource{
4646
Schema: map[string]*schema.Schema{
4747
"limits": {
48-
Type: schema.TypeMap,
49-
Description: "Map describing the maximum amount of compute resources allowed. More info: http://kubernetes.io/docs/user-guide/compute-resources/",
50-
Optional: true,
51-
ForceNew: true,
48+
Type: schema.TypeMap,
49+
Description: "Map describing the maximum amount of compute resources allowed. More info: http://kubernetes.io/docs/user-guide/compute-resources/",
50+
Optional: true,
51+
ForceNew: true,
52+
DiffSuppressFunc: suppressEquivalentResourceQuantity,
5253
},
5354
// This is the only field the API will allow modifying in-place, so ForceNew is not used.
5455
"requests": {
55-
Type: schema.TypeMap,
56-
Description: "Map describing the minimum amount of compute resources required. If this is omitted for a container, it defaults to `limits` if that is explicitly specified, otherwise to an implementation-defined value. More info: http://kubernetes.io/docs/user-guide/compute-resources/",
57-
Optional: true,
56+
Type: schema.TypeMap,
57+
Description: "Map describing the minimum amount of compute resources required. If this is omitted for a container, it defaults to `limits` if that is explicitly specified, otherwise to an implementation-defined value. More info: http://kubernetes.io/docs/user-guide/compute-resources/",
58+
Optional: true,
59+
DiffSuppressFunc: suppressEquivalentResourceQuantity,
5860
},
5961
},
6062
},

0 commit comments

Comments
 (0)