Skip to content

Commit d2fe359

Browse files
author
Nicholas M. Iodice
authored
This change adds case diff supress functions where needed to avoid (#299)
unnecessary resource recreate/update calls
1 parent bef00a8 commit d2fe359

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

azuredevops/resource_agentpool.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils"
1111
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/config"
1212
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/converter"
13+
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/suppress"
1314
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/validate"
1415
)
1516

@@ -30,10 +31,11 @@ func resourceAzureAgentPool() *schema.Resource {
3031
ValidateFunc: validate.NoEmptyStrings,
3132
},
3233
"pool_type": {
33-
Type: schema.TypeString,
34-
Optional: true,
35-
ForceNew: true,
36-
Default: taskagent.TaskAgentPoolTypeValues.Automation,
34+
Type: schema.TypeString,
35+
Optional: true,
36+
ForceNew: true,
37+
Default: taskagent.TaskAgentPoolTypeValues.Automation,
38+
DiffSuppressFunc: suppress.CaseDifference,
3739
ValidateFunc: validation.StringInSlice([]string{
3840
string(taskagent.TaskAgentPoolTypeValues.Automation),
3941
string(taskagent.TaskAgentPoolTypeValues.Deployment),

azuredevops/resource_group_membership.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils"
1414
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/config"
1515
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/converter"
16+
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/suppress"
1617
)
1718

1819
func resourceGroupMembership() *schema.Resource {
@@ -30,9 +31,10 @@ func resourceGroupMembership() *schema.Resource {
3031
ValidateFunc: validation.NoZeroValues,
3132
},
3233
"mode": {
33-
Type: schema.TypeString,
34-
Optional: true,
35-
Default: "add",
34+
Type: schema.TypeString,
35+
Optional: true,
36+
Default: "add",
37+
DiffSuppressFunc: suppress.CaseDifference,
3638
ValidateFunc: validation.StringInSlice([]string{
3739
"add", "overwrite",
3840
}, true),

azuredevops/resource_project.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,21 @@ func resourceProject() *schema.Resource {
4646
Default: "",
4747
},
4848
"visibility": {
49-
Type: schema.TypeString,
50-
Optional: true,
51-
Default: core.ProjectVisibilityValues.Private,
49+
Type: schema.TypeString,
50+
Optional: true,
51+
Default: core.ProjectVisibilityValues.Private,
52+
DiffSuppressFunc: suppress.CaseDifference,
5253
ValidateFunc: validation.StringInSlice([]string{
5354
string(core.ProjectVisibilityValues.Private),
5455
string(core.ProjectVisibilityValues.Public),
5556
}, false),
5657
},
5758
"version_control": {
58-
Type: schema.TypeString,
59-
ForceNew: true,
60-
Optional: true,
61-
Default: core.SourceControlTypesValues.Git,
59+
Type: schema.TypeString,
60+
ForceNew: true,
61+
Optional: true,
62+
Default: core.SourceControlTypesValues.Git,
63+
DiffSuppressFunc: suppress.CaseDifference,
6264
ValidateFunc: validation.StringInSlice([]string{
6365
string(core.SourceControlTypesValues.Git),
6466
string(core.SourceControlTypesValues.Tfvc),

azuredevops/resource_resource_authorization.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/microsoft/azure-devops-go-api/azuredevops/build"
1010
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/config"
1111
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/converter"
12+
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/suppress"
1213
)
1314

1415
const msgErrorFailedResourceCreate = "error creating authorized resource: %+v"
@@ -35,11 +36,12 @@ func resourceResourceAuthorization() *schema.Resource {
3536
ValidateFunc: validation.IsUUID,
3637
},
3738
"type": {
38-
Type: schema.TypeString,
39-
Optional: true,
40-
Default: "endpoint",
41-
Description: "type of the resource",
42-
ValidateFunc: validation.StringInSlice([]string{"endpoint"}, false),
39+
Type: schema.TypeString,
40+
Optional: true,
41+
Default: "endpoint",
42+
Description: "type of the resource",
43+
DiffSuppressFunc: suppress.CaseDifference,
44+
ValidateFunc: validation.StringInSlice([]string{"endpoint"}, false),
4345
},
4446
"authorized": {
4547
Type: schema.TypeBool,

azuredevops/resource_user_entitlement.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/microsoft/azure-devops-go-api/azuredevops/memberentitlementmanagement"
1414
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils"
1515
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/config"
16+
"github.com/microsoft/terraform-provider-azuredevops/azuredevops/utils/suppress"
1617
)
1718

1819
func resourceUserEntitlement() *schema.Resource {
@@ -33,11 +34,12 @@ func resourceUserEntitlement() *schema.Resource {
3334
ForceNew: true,
3435
},
3536
"origin": {
36-
Type: schema.TypeString,
37-
Optional: true,
38-
ForceNew: true,
39-
Default: "aad",
40-
ValidateFunc: validation.StringInSlice([]string{"aad", "ghb"}, false),
37+
Type: schema.TypeString,
38+
Optional: true,
39+
ForceNew: true,
40+
Default: "aad",
41+
DiffSuppressFunc: suppress.CaseDifference,
42+
ValidateFunc: validation.StringInSlice([]string{"aad", "ghb"}, false),
4143
},
4244
"account_license_type": {
4345
Type: schema.TypeString,

0 commit comments

Comments
 (0)