Created
May 26, 2018 10:52
-
-
Save thbkrkr/66653adce3bb57278f99d8cb3dc4ba7f to your computer and use it in GitHub Desktop.
Terraform config to deploy a bunch of yaml
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
variable kubeconfig { | |
default = "/ops/clusters/c1.test/config/kubectl.secrets.conf" | |
} | |
variable dirconfig { | |
default = "/ops/k8s-deployments/kube-state-metrics" | |
} | |
variable prefix { | |
default = "kube-state-metrics-" | |
} | |
resource "null_resource" "kubectl" { | |
triggers { | |
id = "${ | |
sha1(format("%s%s%s%s%s%s%s", | |
file("${var.dir}/${var.prefix}cluster-role-binding.yaml"), | |
file("${var.dir}/${var.prefix}cluster-role.yaml"), | |
file("${var.dir}/${var.prefix}deployment.yaml"), | |
file("${var.dir}/${var.prefix}role-binding.yaml"), | |
file("${var.dir}/${var.prefix}role.yaml"), | |
file("${var.dir}/${var.prefix}service-account.yaml"), | |
file("${var.dir}/${var.prefix}service.yaml") | |
))}" | |
} | |
provisioner "local-exec" { | |
command = "kubectl --kubeconfig=${var.kubeconfig} apply -f ${var.dirconfig}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment