Skip to content

Commit

Permalink
fix: remove circular dependency between app and secret (#32)
Browse files Browse the repository at this point in the history
* fix: remove circular dependency between app and secret

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

---------

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

Release-As: v1.0.0-alpha.5
  • Loading branch information
modridi authored Jan 30, 2023
1 parent c8cd6cb commit cb9f2d3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
6 changes: 4 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The following resources are used by this module:

- https://registry.terraform.io/providers/oboukili/argocd/latest/docs/resources/application[argocd_application.this] (resource)
- https://registry.terraform.io/providers/oboukili/argocd/latest/docs/resources/project[argocd_project.this] (resource)
- https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace[kubernetes_namespace.kube_prometheus_stack_namespace] (resource)
- https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret[kubernetes_secret.thanos_object_storage_secret] (resource)
- https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.dependencies] (resource)
- https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.this] (resource)
Expand Down Expand Up @@ -154,7 +155,7 @@ Description: Override of target revision of the application chart.

Type: `string`

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

=== Outputs

Expand Down Expand Up @@ -206,6 +207,7 @@ Description: n/a
|Name |Type
|https://registry.terraform.io/providers/oboukili/argocd/latest/docs/resources/application[argocd_application.this] |resource
|https://registry.terraform.io/providers/oboukili/argocd/latest/docs/resources/project[argocd_project.this] |resource
|https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace[kubernetes_namespace.kube_prometheus_stack_namespace] |resource
|https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret[kubernetes_secret.thanos_object_storage_secret] |resource
|https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.dependencies] |resource
|https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource[null_resource.this] |resource
Expand Down Expand Up @@ -314,7 +316,7 @@ object({
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v1.0.0-alpha.3"`
|`"v1.0.0-alpha.4"`
|no

|===
Expand Down
4 changes: 2 additions & 2 deletions aks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Description: Override of target revision of the application chart.

Type: `string`

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

=== Outputs

Expand Down Expand Up @@ -328,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.3"`
|`"v1.0.0-alpha.4"`
|no

|===
Expand Down
4 changes: 2 additions & 2 deletions eks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Description: Override of target revision of the application chart.

Type: `string`

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

=== Outputs

Expand Down Expand Up @@ -310,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.3"`
|`"v1.0.0-alpha.4"`
|no

|===
Expand Down
16 changes: 11 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ resource "argocd_project" "this" {
}
}

resource "kubernetes_namespace" "kube_prometheus_stack_namespace" {
metadata {
name = var.namespace
}
}


resource "kubernetes_secret" "thanos_object_storage_secret" {
# This count here is nothing more than a way to conditionally deploy this
# resource. Although there is no loop inside the resource, if the condition
# is true, the resource is deployed because there is exactly one iteration.
count = var.metrics_storage_main != null ? 1 : 0

metadata {
Expand All @@ -55,7 +59,7 @@ resource "kubernetes_secret" "thanos_object_storage_secret" {
}

depends_on = [
resource.argocd_application.this,
resource.kubernetes_namespace.kube_prometheus_stack_namespace
]
}

Expand Down Expand Up @@ -114,13 +118,15 @@ resource "argocd_application" "this" {
}

sync_options = [
"CreateNamespace=true"
"CreateNamespace=false"
]
}
}

depends_on = [
resource.null_resource.dependencies,
resource.kubernetes_secret.thanos_object_storage_secret,
resource.kubernetes_namespace.kube_prometheus_stack_namespace
]
}

Expand Down

0 comments on commit cb9f2d3

Please sign in to comment.