Skip to content

Commit

Permalink
feat: implemented ignore_difference option
Browse files Browse the repository at this point in the history
Signed-off-by: leonsteinhaeuser <[email protected]>
  • Loading branch information
leonsteinhaeuser committed Oct 26, 2023
1 parent 83ce7ad commit 3d87475
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ resource "argocd_application_set" "this" {
}
}

dynamic "ignore_difference" {
// to protect against null values, we need to check if the ignore_difference block is not null
for_each = var.ignore_difference != null ? var.ignore_difference : []
content {
group = ignore_difference.value.group
jq_path_expressions = ignore_difference.value.jq_path_expressions
json_pointers = ignore_difference.value.json_pointers
kind = ignore_difference.value.kind
name = ignore_difference.value.name
namespace = ignore_difference.value.namespace
}
}

destination {
name = "{{ if (eq ${local.cluster_identifier} \"general-purpose\") }}in-cluster{{ else }}{{ ${local.cluster_identifier} }}{{ end }}"
// if the target_namespace_overwrite is not empty, then we want to use it as the namespace
Expand Down
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,16 @@ variable "sync_policy" {
description = "ArgoCD sync policy configuration"
default = null
}

variable "ignore_difference" {
type = list(object({
group = optional(string)
jq_path_expressions = optional(list(string))
json_pointers = optional(list(string))
kind = optional(string)
name = optional(string)
namespace = optional(string)
}))
description = "A list of object kinds to ignore during the diff process. This is useful if you want to ignore certain differences between the application set and the cluster. e.g. if you want to ignore differences in the namespace labels."
default = []
}

0 comments on commit 3d87475

Please sign in to comment.