Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add exceptions to the orphaned resources warning #115

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v5.0.0"`
Default: `"v5.2.0"`

==== [[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>

Expand Down Expand Up @@ -692,12 +692,12 @@ Description: Map of extra accounts that were created and their tokens.
[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|[[provider_null]] <<provider_null,null>> |>= 3
|[[provider_jwt]] <<provider_jwt,jwt>> |>= 1.1
|[[provider_time]] <<provider_time,time>> |>= 0.9
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 5
|[[provider_utils]] <<provider_utils,utils>> |>= 1.6
|[[provider_null]] <<provider_null,null>> |>= 3
|===

= Resources
Expand Down Expand Up @@ -753,7 +753,7 @@ Description: Map of extra accounts that were created and their tokens.
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v5.0.0"`
|`"v5.2.0"`
|no

|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
Expand Down
14 changes: 8 additions & 6 deletions bootstrap/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ Type:
[source,hcl]
----
map(object({
destination_cluster = string
allowed_source_repos = optional(list(string), ["*"])
allowed_namespaces = optional(list(string), ["*"])
destination_cluster = string
allowed_source_repos = optional(list(string), ["*"])
allowed_namespaces = optional(list(string), ["*"])
orphaned_resources_warning = optional(bool, true)
}))
----

Expand Down Expand Up @@ -242,9 +243,10 @@ At a minimum, you need to provide the `destination_cluster` value, so that the d
[source]
----
map(object({
destination_cluster = string
allowed_source_repos = optional(list(string), ["*"])
allowed_namespaces = optional(list(string), ["*"])
destination_cluster = string
allowed_source_repos = optional(list(string), ["*"])
allowed_namespaces = optional(list(string), ["*"])
orphaned_resources_warning = optional(bool, true)
}))
----

Expand Down
16 changes: 15 additions & 1 deletion bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,21 @@ resource "argocd_project" "devops_stack_applications" {
}

orphaned_resources {
warn = true
warn = each.value.orphaned_resources_warning

# Because we are creating the Argo CD resources using Terraform, these appear as orphaned resources in the Argo CD
# interface, so we need to ignore them.
ignore {
group = "argoproj.io"
kind = "*"
name = "*"
}

# Most of the Secrets are created by the External Secrets operator, so it's best they are ignored.
ignore {
kind = "Secret"
name = "*"
}
}

cluster_resource_whitelist {
Expand Down
7 changes: 4 additions & 3 deletions bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ variable "argocd_projects" {
*The first cluster in the list should always be your main cluster where the Argo CD will be deployed, and the destination cluster for that project must be `in-cluster`.*
EOT
type = map(object({
destination_cluster = string
allowed_source_repos = optional(list(string), ["*"])
allowed_namespaces = optional(list(string), ["*"])
destination_cluster = string
allowed_source_repos = optional(list(string), ["*"])
allowed_namespaces = optional(list(string), ["*"])
orphaned_resources_warning = optional(bool, true)
}))
default = {}

Expand Down
14 changes: 14 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ resource "argocd_project" "this" {

orphaned_resources {
warn = true

# Because we are creating the Argo CD resources using Terraform, these appear as orphaned resources in the Argo CD
# interface, so we need to ignore them.
ignore {
group = "argoproj.io"
kind = "*"
name = "*"
}

# Most of the Secrets are created by the External Secrets operator, so it's best they are ignored.
ignore {
kind = "Secret"
name = "*"
}
}

cluster_resource_whitelist {
Expand Down