From f63119d0b97842f08f726afd360bd4f6004a41eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Fri, 15 Sep 2023 14:16:59 +0200 Subject: [PATCH] feat: add standard variables and variable to add labels to Argo CD app --- aks/main.tf | 1 + eks/main.tf | 1 + kind/main.tf | 1 + main.tf | 4 ++++ sks/main.tf | 1 + variables.tf | 6 ++++++ 6 files changed, 14 insertions(+) diff --git a/aks/main.tf b/aks/main.tf index 44ee1f74..2c149053 100644 --- a/aks/main.tf +++ b/aks/main.tf @@ -34,6 +34,7 @@ module "thanos" { base_domain = var.base_domain argocd_namespace = var.argocd_namespace argocd_project = var.argocd_project + argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster target_revision = var.target_revision cluster_issuer = var.cluster_issuer diff --git a/eks/main.tf b/eks/main.tf index a55caafc..9cccf5dc 100644 --- a/eks/main.tf +++ b/eks/main.tf @@ -5,6 +5,7 @@ module "thanos" { base_domain = var.base_domain argocd_namespace = var.argocd_namespace argocd_project = var.argocd_project + argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster target_revision = var.target_revision cluster_issuer = var.cluster_issuer diff --git a/kind/main.tf b/kind/main.tf index a55caafc..9cccf5dc 100644 --- a/kind/main.tf +++ b/kind/main.tf @@ -5,6 +5,7 @@ module "thanos" { base_domain = var.base_domain argocd_namespace = var.argocd_namespace argocd_project = var.argocd_project + argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster target_revision = var.target_revision cluster_issuer = var.cluster_issuer diff --git a/main.tf b/main.tf index 38bb1b73..553042be 100644 --- a/main.tf +++ b/main.tf @@ -46,6 +46,10 @@ resource "argocd_application" "this" { metadata { name = var.destination_cluster != "in-cluster" ? "thanos-${var.destination_cluster}" : "thanos" namespace = var.argocd_namespace + labels = merge({ + "application" = "thanos" + "cluster" = var.destination_cluster + }, var.argocd_labels) } timeouts { diff --git a/sks/main.tf b/sks/main.tf index a55caafc..9cccf5dc 100644 --- a/sks/main.tf +++ b/sks/main.tf @@ -5,6 +5,7 @@ module "thanos" { base_domain = var.base_domain argocd_namespace = var.argocd_namespace argocd_project = var.argocd_project + argocd_labels = var.argocd_labels destination_cluster = var.destination_cluster target_revision = var.target_revision cluster_issuer = var.cluster_issuer diff --git a/variables.tf b/variables.tf index 84df0829..b6ac2a26 100644 --- a/variables.tf +++ b/variables.tf @@ -24,6 +24,12 @@ variable "argocd_project" { default = null } +variable "argocd_labels" { + description = "Labels to attach to the Argo CD Application resource." + type = map(string) + default = {} +} + variable "destination_cluster" { description = "Destination cluster where the application should be deployed." type = string