resource "kubernetes_namespace" "app_dynatrace_namespace" {
count = var.application_cluster_dynatrace ? 1 : 0
# provider = kubernetes
metadata {
name = var.splitter_dynatrace_namespace
}
depends_on = [null_resource.cluster_creation]
}
resource "helm_release" "application_cluster_dynatrace" {
count = var.application_cluster_dynatrace ? 1 : 0
# provider = helm
repository = "https://raw.githubusercontent.com/Dynatrace/helm-charts/master/repos/stable/"
chart = "dynatrace-oneagent-operator"
name = "dynatrace-oneagent-operator"
namespace = var.app_dynatrace_namespace
values = [
var.application_cluster_dynatrace ? "${file("dev/dynatrace/dynatrace.yaml")}" : null
]
depends_on = [kubernetes_namespace.app_dynatrace_namespace]
}
变量文件具有以下内容:
variable "application_cluster_dynatrace" {}
variable "app_dynatrace_namespace" { default = "devns" }
我正在使用上面的 terraform 脚本在 kubernetes 集群中创建命名空间,然后为 dynatrace 代理安装 helm chart。当我运行脚本并在运行时提及“0”或 false 时,terraform 会破坏命名空间和 dynatrace 配置。当在运行时传递“0”或 false 时,terraform 中是否有办法不破坏命名空间(忽略步骤)?
Terraform v0.12.26
- 提供者.google v3.24.0
- provider.google-beta v3.33.0
- provider.helm v1.2.2
- provider.kubernetes v1.11.3
- provider.null v2.1.2