Skip to content

Commit

Permalink
suppress diffs on label
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuZad committed Dec 6, 2024
1 parent 9b61ec5 commit ae35405
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/provider/resource_dynamic_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ func resourceDynamicGroup() *schema.Resource {
Description: "One or more label entries that apply to the Group. Currently supported labels contain a key with an empty value.",
Type: schema.TypeMap,
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
DiffSuppressFunc: suppressDynamicLabel,
},
},
}
Expand Down Expand Up @@ -371,3 +373,13 @@ func convertInterfaceMapToStringMap(input map[string]interface{}) (map[string]st
}
return output, nil
}

func suppressDynamicLabel(k, old, new string, d *schema.ResourceData) bool {
labelKey := strings.TrimPrefix(k, "labels.")

if labelKey == "cloudidentity.googleapis.com/groups.dynamic" {
// Suppress the diff for the API-added label
return true
}
return false
}

0 comments on commit ae35405

Please sign in to comment.