Skip to content

Instantly share code, notes, and snippets.

@Akaame
Created July 30, 2021 17:01
Show Gist options
  • Save Akaame/d75a107ecdcc225d0db1a8e699674c87 to your computer and use it in GitHub Desktop.
Save Akaame/d75a107ecdcc225d0db1a8e699674c87 to your computer and use it in GitHub Desktop.
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"
}
data "kustomization_overlay" "psql-ui" {
resources = [ local.psql_ui_path ] # kustomization source
# patch name of every resource with its namespace assigned to "default" in the kustomization
patches {
patch = <<-EOF
- op: replace
path: /metadata/namespace
value: ${kubernetes_namespace.ha-psql.metadata.0.name}
EOF
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]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment