Skip to content

Commit

Permalink
feat: add variable to configure Argo CD auto sync (#27)
Browse files Browse the repository at this point in the history
* feat(main): introduce a variable to set autosync

* feat(main): add variable for target_revision in argocd app

* fix(main): set optional attribut in app_autosync

* fix(aks-eks): propagate target_revision

* fix: rename var resource group name and document its purpose

* ci: add central workflows including release-please (#17)

* chore: add CODEOWNERS file

* ci: add linters and terraform-docs workflows

* ci: add release-please workflow and associated modifications

* test: test corrected workflow

* docs(terraform-docs): generate docs and write to README.adoc

* revert: "test: test corrected workflow"

This reverts commit 609d8c4.

Co-authored-by: lentidas <[email protected]>

Release-As: v1.0.0-alpha.1

* chore(main): release 1.0.0-alpha.1 (#20)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(aks): add azure main

* chore(aks): add version file

* fix(aks): eof

* fix: do not expose values as secret

* fix: wait for app, else provider says app is not existent on destroy

* chore(azure)!: delete useless resource group variable and clean up

* docs(terraform-docs): generate docs and write to README.adoc

* refactor: delete leftover from legacy code (#25)

* docs(terraform-docs): generate docs and write to README.adoc

* fix(main): remove duplicated target_revision attribut

* docs(terraform-docs): generate docs and write to README.adoc

* Update variable autosync description

Co-authored-by: Gonçalo Heleno <[email protected]>

* docs(terraform-docs): generate docs and write to README.adoc

* feat: add kind variant and improve activation of thanos on all the variants (#21)

* feat(eks): use proper variable to receive metrics storage config

* feat: generate bucket config in variant then pass to main mod

* feat: add kind variant

* docs(terraform-docs): generate docs and write to README.adoc

* refactor: refactor conditions

* fix: add sensitive flag to sensitive variables

* refactor: rename local.tf to locals.tf

* revert: "fix: add sensitive flag to sensitive variables"

This reverts commit f816f1f.

* docs: fix typo

* fix: fix the error on deployment because the count depended on value

* docs(terraform-docs): generate docs and write to README.adoc

* fix: remove enabled flag in the kind variant

* fix: remove sensitive flag from bucket variables because it breaks conditions

* feat: further enhance Thanos activation across all variants

Co-authored-by: Mohamed Amine Dridi <[email protected]>

* chore: merge main to branch

* fix(aks): correct merge errors

* refactor: rename kube secret object in terraform

* feat: add symbolic links for the versions.tf

* fix: add forgotten required provider

* docs(terraform-docs): generate docs and write to README.adoc

* chore: terraform fmt

Co-authored-by: lentidas <[email protected]>
Co-authored-by: Mohamed Amine Dridi <[email protected]>
Release-As: v1.0.0-alpha.2

* chore(main): release 1.0.0-alpha.2 (#28)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat(Azure): add missing ID output (#30)

* feat(Azure): add missing ID output

* docs(terraform-docs): generate docs and write to README.adoc

Co-authored-by: modridi <[email protected]>

Release-As: v1.0.0-alpha.3

* chore(main): release 1.0.0-alpha.3 (#31)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat: add variable passthrough for variants and dependency on var.app_autosync

* docs(terraform-docs): generate docs and write to README.adoc

* fix: add tobool function

---------

Co-authored-by: Xavier Rakotomamonjy <[email protected]>
Co-authored-by: Federico Sismondi <[email protected]>
Co-authored-by: Gonçalo Heleno <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jérémy Barascut <[email protected]>
Co-authored-by: modridi <[email protected]>
Co-authored-by: modridi <[email protected]>
Co-authored-by: Xaving <[email protected]>
Co-authored-by: lentidas <[email protected]>
Co-authored-by: Mohamed Amine Dridi <[email protected]>
Co-authored-by: Gonçalo Heleno <[email protected]>

Release-As: v1.0.0-alpha.4
  • Loading branch information
Xaving authored Jan 30, 2023
1 parent 0b704e8 commit 214b798
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 15 deletions.
54 changes: 52 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,30 @@ Type: `any`

Default: `{}`

==== [[input_app_autosync]] <<input_app_autosync,app_autosync>>

Description: Automated sync options for the Argo CD Application resource.

Type:
[source,hcl]
----
object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
----

Default:
[source,json]
----
{
"allow_empty": false,
"prune": true,
"self_heal": true
}
----

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

Description: n/a
Expand Down Expand Up @@ -130,7 +154,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v1.0.0-alpha.2"`
Default: `"v1.0.0-alpha.3"`

=== Outputs

Expand Down Expand Up @@ -201,6 +225,32 @@ Description: n/a
|`{}`
|no

|[[input_app_autosync]] <<input_app_autosync,app_autosync>>
|Automated sync options for the Argo CD Application resource.
|

[source]
----
object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
----

|

[source]
----
{
"allow_empty": false,
"prune": true,
"self_heal": true
}
----

|no

|[[input_argocd_namespace]] <<input_argocd_namespace,argocd_namespace>>
|n/a
|`string`
Expand Down Expand Up @@ -264,7 +314,7 @@ Description: n/a
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v1.0.0-alpha.2"`
|`"v1.0.0-alpha.3"`
|no

|===
Expand Down
54 changes: 52 additions & 2 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ Type: `any`

Default: `{}`

==== [[input_app_autosync]] <<input_app_autosync,app_autosync>>

Description: Automated sync options for the Argo CD Application resource.

Type:
[source,hcl]
----
object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
----

Default:
[source,json]
----
{
"allow_empty": false,
"prune": true,
"self_heal": true
}
----

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

Description: n/a
Expand Down Expand Up @@ -144,7 +168,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v1.0.0-alpha.2"`
Default: `"v1.0.0-alpha.3"`

=== Outputs

Expand Down Expand Up @@ -193,6 +217,32 @@ Description: n/a
|`{}`
|no

|[[input_app_autosync]] <<input_app_autosync,app_autosync>>
|Automated sync options for the Argo CD Application resource.
|

[source]
----
object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
----

|

[source]
----
{
"allow_empty": false,
"prune": true,
"self_heal": true
}
----

|no

|[[input_argocd_namespace]] <<input_argocd_namespace,argocd_namespace>>
|n/a
|`string`
Expand Down Expand Up @@ -278,7 +328,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v1.0.0-alpha.2"`
|`"v1.0.0-alpha.3"`
|no

|===
Expand Down
4 changes: 3 additions & 1 deletion aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ module "kube-prometheus-stack" {
source = "../"

cluster_name = var.cluster_name
argocd_namespace = var.argocd_namespace
base_domain = var.base_domain
argocd_namespace = var.argocd_namespace
target_revision = var.target_revision
cluster_issuer = var.cluster_issuer
namespace = var.namespace
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids

prometheus = var.prometheus
Expand Down
54 changes: 52 additions & 2 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,30 @@ Type: `any`

Default: `{}`

==== [[input_app_autosync]] <<input_app_autosync,app_autosync>>

Description: Automated sync options for the Argo CD Application resource.

Type:
[source,hcl]
----
object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
----

Default:
[source,json]
----
{
"allow_empty": false,
"prune": true,
"self_heal": true
}
----

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

Description: n/a
Expand Down Expand Up @@ -133,7 +157,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v1.0.0-alpha.2"`
Default: `"v1.0.0-alpha.3"`

=== Outputs

Expand Down Expand Up @@ -181,6 +205,32 @@ Description: n/a
|`{}`
|no

|[[input_app_autosync]] <<input_app_autosync,app_autosync>>
|Automated sync options for the Argo CD Application resource.
|

[source]
----
object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
----

|

[source]
----
{
"allow_empty": false,
"prune": true,
"self_heal": true
}
----

|no

|[[input_argocd_namespace]] <<input_argocd_namespace,argocd_namespace>>
|n/a
|`string`
Expand Down Expand Up @@ -260,7 +310,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v1.0.0-alpha.2"`
|`"v1.0.0-alpha.3"`
|no

|===
Expand Down
4 changes: 3 additions & 1 deletion eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module "kube-prometheus-stack" {
source = "../"

cluster_name = var.cluster_name
argocd_namespace = var.argocd_namespace
base_domain = var.base_domain
argocd_namespace = var.argocd_namespace
target_revision = var.target_revision
cluster_issuer = var.cluster_issuer
namespace = var.namespace
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids

prometheus = var.prometheus
Expand Down
4 changes: 3 additions & 1 deletion kind/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module "kube-prometheus-stack" {
source = "../"

cluster_name = var.cluster_name
argocd_namespace = var.argocd_namespace
base_domain = var.base_domain
argocd_namespace = var.argocd_namespace
target_revision = var.target_revision
cluster_issuer = var.cluster_issuer
namespace = var.namespace
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids

prometheus = var.prometheus
Expand Down
8 changes: 2 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ resource "argocd_application" "this" {
delete = "15m"
}

wait = true
wait = var.app_autosync == { "allow_empty" = tobool(null), "prune" = tobool(null), "self_heal" = tobool(null) } ? false : true

spec {
project = argocd_project.this.metadata.0.name
Expand All @@ -103,11 +103,7 @@ resource "argocd_application" "this" {
}

sync_policy {
automated = {
allow_empty = false
prune = true
self_heal = true
}
automated = var.app_autosync

retry {
backoff = {
Expand Down
14 changes: 14 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ variable "helm_values" {
default = []
}

variable "app_autosync" {
description = "Automated sync options for the Argo CD Application resource."
type = object({
allow_empty = optional(bool)
prune = optional(bool)
self_heal = optional(bool)
})
default = {
allow_empty = false
prune = true
self_heal = true
}
}

variable "dependency_ids" {
type = map(string)
default = {}
Expand Down

0 comments on commit 214b798

Please sign in to comment.