Skip to content

Instantly share code, notes, and snippets.

@pkolyvas
Forked from redeux/main.tf
Created December 17, 2020 16:15
Show Gist options
  • Save pkolyvas/68a28feab28163ca46b5c9cdea87444a to your computer and use it in GitHub Desktop.
Save pkolyvas/68a28feab28163ca46b5c9cdea87444a to your computer and use it in GitHub Desktop.
Terraform Progressive Apply
locals {
kubeconfig_file = "${path.module}/kubeconfig"
}
provider "local" {}
# provider "kubernetes" {
# config_path = local.kubeconfig_file
# }
provider "kubernetes" {
config_path = local_file.kubeconfig.filename
}
resource "local_file" "kubeconfig" {
depends_on = [local_file.otherstuff]
filename = "${path.module}/kubeconfig"
content = file("~/.kube/config")
}
resource "local_file" "otherstuff" {
count = 10
filename = "${path.module}/otherstuff.${count.index}"
content = file("~/.kube/config")
}
resource "kubernetes_config_map" "test" {
depends_on = [local_file.kubeconfig]
metadata {
name = "test"
}
data = {
"foo" = "bar"
}
}
output "locals_kubeconfig_file" {
value = local.kubeconfig_file
}
output "local_file_kubeconfig" {
value = local_file.kubeconfig.filename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment