Skip to content

Commit

Permalink
Merge CompareCaseInsensitive with CaseDiffSuppress (#9898) (hashicorp…
Browse files Browse the repository at this point in the history
…#6920)

[upstream:d0abd7fde237f1cde4f5e22f06e671ac8e6c610e]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jan 31, 2024
1 parent 4964086 commit 8d1493b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .changelog/9898.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func ResourceArtifactRegistryRepository() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: `The format of packages that are stored in the repository. Supported formats
can be found [here](https://cloud.google.com/artifact-registry/docs/supported-formats).
You can only create alpha formats if you are a member of the
Expand Down
4 changes: 2 additions & 2 deletions google-beta/services/compute/resource_compute_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func computeFirewallAllowSchema() *schema.Resource {
"protocol": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: `The IP protocol to which this rule applies. The protocol type is
required when creating a firewall rule. This value can either be
one of the following well known protocol strings (tcp, udp,
Expand Down Expand Up @@ -418,7 +418,7 @@ func computeFirewallDenySchema() *schema.Resource {
"protocol": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: `The IP protocol to which this rule applies. The protocol type is
required when creating a firewall rule. This value can either be
one of the following well known protocol strings (tcp, udp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func ContainerAwsClusterControlPlaneInstancePlacementSchema() *schema.Resource {
Computed: true,
Optional: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "The tenancy for the instance. Possible values: TENANCY_UNSPECIFIED, DEFAULT, DEDICATED, HOST",
},
},
Expand Down Expand Up @@ -468,7 +468,7 @@ func ContainerAwsClusterControlPlaneMainVolumeSchema() *schema.Resource {
Computed: true,
Optional: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "Optional. Type of the EBS volume. When unspecified, it defaults to GP2 volume. Possible values: VOLUME_TYPE_UNSPECIFIED, GP2, GP3",
},
},
Expand Down Expand Up @@ -527,7 +527,7 @@ func ContainerAwsClusterControlPlaneRootVolumeSchema() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Optional: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "Optional. Type of the EBS volume. When unspecified, it defaults to GP2 volume. Possible values: VOLUME_TYPE_UNSPECIFIED, GP2, GP3",
},
},
Expand Down Expand Up @@ -637,7 +637,7 @@ func ContainerAwsClusterLoggingConfigComponentConfigSchema() *schema.Resource {
Type: schema.TypeList,
Computed: true,
Optional: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "Components of the logging configuration to be enabled.",
Elem: &schema.Schema{Type: schema.TypeString},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func ContainerAwsNodePoolConfigInstancePlacementSchema() *schema.Resource {
Computed: true,
Optional: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "The tenancy for the instance. Possible values: TENANCY_UNSPECIFIED, DEFAULT, DEDICATED, HOST",
},
},
Expand Down Expand Up @@ -429,7 +429,7 @@ func ContainerAwsNodePoolConfigRootVolumeSchema() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Optional: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "Optional. Type of the EBS volume. When unspecified, it defaults to GP2 volume. Possible values: VOLUME_TYPE_UNSPECIFIED, GP2, GP3",
},
},
Expand Down Expand Up @@ -469,7 +469,7 @@ func ContainerAwsNodePoolConfigTaintsSchema() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "The taint effect. Possible values: EFFECT_UNSPECIFIED, NO_SCHEDULE, PREFER_NO_SCHEDULE, NO_EXECUTE",
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func ContainerAzureClusterLoggingConfigComponentConfigSchema() *schema.Resource
Type: schema.TypeList,
Computed: true,
Optional: true,
DiffSuppressFunc: tpgresource.CompareCaseInsensitive,
DiffSuppressFunc: tpgresource.CaseDiffSuppress,
Description: "Components of the logging configuration to be enabled.",
Elem: &schema.Schema{Type: schema.TypeString},
},
Expand Down
4 changes: 0 additions & 4 deletions google-beta/tpgresource/common_diff_suppress.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@ func ProjectNumberDiffSuppress(_, old, new string, _ *schema.ResourceData) bool
return a2 == b2
}

func CompareCaseInsensitive(k, old, new string, d *schema.ResourceData) bool {
return strings.ToLower(old) == strings.ToLower(new)
}

func IsNewResource(diff TerraformResourceDiff) bool {
name := diff.Get("name")
return name.(string) == ""
Expand Down

0 comments on commit 8d1493b

Please sign in to comment.