Skip to content
Merged
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
19 changes: 8 additions & 11 deletions modules/infra/argocd/main.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
locals {
argocd_password_hash = bcrypt(var.admin_password, 10)
values_yaml = templatefile("${path.module}/values.yaml", {
argocd_password_hash = local.argocd_password_hash
})
}

resource "helm_release" "argocd" {
name = "argocd"
chart = "argo-cd"
namespace = "argocd"
repository = "https://argoproj.github.io/argo-helm"
version = "7.7.21"

values = [
file("${path.module}/values.yaml")
]
values = [local.values_yaml]

depends_on = [kubernetes_manifest.argocd_cmp_plugin]
}
Expand Down Expand Up @@ -40,11 +45,3 @@ resource "kubernetes_secret" "argocd_vault_plugin_credentials" {
depends_on = [helm_release.argocd]
}

data "kubernetes_secret" "argocd_initial_password" {
metadata {
name = "argocd-initial-admin-secret"
namespace = "argocd"
}

depends_on = [helm_release.argocd]
}
2 changes: 2 additions & 0 deletions modules/infra/argocd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ server:
configs:
params:
server.insecure: true
secret:
argocdServerAdminPassword: "${argocd_password_hash}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash값의 경우에는 특히!! 큰따옴표로 감쌀 것


# argocd-vault-plugin
repoServer:
Expand Down
5 changes: 5 additions & 0 deletions modules/infra/argocd/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "admin_password" {
type = string
description = "admin password"
sensitive = true
}
6 changes: 6 additions & 0 deletions projects/infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ module "opentelemetry" {
source = "../../modules/infra/opentelemetry"
}

data "vault_kv_secret_v2" "argocd" {
mount = "kv"
name = "infra/argocd"
}

module "argocd" {
source = "../../modules/infra/argocd"
admin_password = data.vault_kv_secret_v2.argocd.data["password"]
}

module "argocd-application" {
Expand Down