Created
January 10, 2023 16:06
-
-
Save rjosephwright/f1485cddcc12dd651ec96558ac7601c6 to your computer and use it in GitHub Desktop.
Terraform wrapper for Helm chart with additional resources
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 "helm_values" { | |
type = any | |
default = { | |
abc = "xyz" | |
} | |
} | |
variable "namespace" { | |
type = string | |
} | |
# Other variables omitted... | |
# Uses the Kubernetes provider. Note helm can already create | |
# the namespace for the release, but this is just for an example. | |
resource "kubernetes_namespace" "it" { | |
metadata = { | |
name = var.namespace | |
} | |
} | |
# Uses Helm provider. | |
resource "helm_release" "it" { | |
chart = var.helm_chart | |
name = var.helm_release | |
# Using output of kubernetes_namespace resource enforces | |
# ordering, rather than passing in var.namespace. | |
namespace = one(kubernetes_namespace.it.metadata[*].name) | |
repository = var.helm_repository | |
values = [yamlencode(var.helm_values)] | |
version = var.helm_chart_version | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment