Last active
July 31, 2021 06:54
-
-
Save Akaame/9b4288d004b125f3f182f3e113607b51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
psql_ui_path = "github.com/zalando/postgres-operator/ui/manifests" | |
} | |
terraform { | |
required_providers { | |
kustomization = { | |
source = "kbst/kustomization" | |
version = "0.5.0" | |
} | |
} | |
} | |
provider "kustomization" { | |
kubeconfig_path = "~/.kube/config" | |
} | |
provider "kubernetes" { | |
config_path = "~/.kube/config" | |
} | |
resource "kubernetes_namespace" "ha-psql" { | |
metadata { | |
name = "ha-psql" | |
} | |
} | |
data "kustomization_overlay" "psql-ui" { | |
resources = [ local.psql_ui_path ] | |
patches { | |
patch = <<-EOF | |
- op: replace | |
path: /metadata/namespace | |
value: ${kubernetes_namespace.ha-psql.metadata.0.name} | |
EOF | |
# change the value to static "ha-psql" it works | |
# As it is it throw error: value depends on resource attributes that cannot be determined until apply | |
target = { | |
namespace = "default" | |
} | |
} | |
} | |
resource "kustomization_resource" "psql-ui" { | |
for_each = data.kustomization_overlay.psql-ui.ids | |
manifest = data.kustomization_overlay.psql-ui.manifests[each.value] | |
depends_on = [ | |
data.kustomization_overlay.psql-ui | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment