Created
August 15, 2023 21:23
-
-
Save antonputra/d70ff6d3015647edee9916cca301f3ba to your computer and use it in GitHub Desktop.
How to apply MULTIPLE Kubernetes manifests using Terraform?
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
# Install kubectl provider | |
terraform { | |
required_version = ">= 0.13" | |
required_providers { | |
kubectl = { | |
source = "gavinbunney/kubectl" | |
version = ">= 1.14.0" | |
} | |
} | |
} | |
# Configure kubectl provider | |
provider "kubectl" { | |
config_path = "~/.kube/config" | |
} | |
# Load ALL manifest documents | |
data "kubectl_path_documents" "manifests" { | |
pattern = "./manifests/*.yaml" | |
} | |
# Apply ALL manifests | |
resource "kubectl_manifest" "prometheus_operator" { | |
for_each = toset(data.kubectl_path_documents.manifests.documents) | |
yaml_body = each.value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment