Demo how to use Terraform Helm provider to install Helm Chart
- Kubernetes 1.19+
- Terraform 1.2.9
- Terraform Helm Provider 2.7.0
- Create a bucket for backend.tf to store Terraform state file
# valid LOCATION values are `asia`, `eu` or `us`
gsutil mb -l $LOCATION gs://$BUCKET_NAME
gsutil versioning set on gs://$BUCKET_NAME
- File config - config_path = "~/.kube/config" in providers.tf
The easiest way is to supply a path to your kubeconfig file using the config_path attribute or using the KUBE_CONFIG_PATH environment variable. A kubeconfig file may have multiple contexts. If config_context is not specified, the provider will use the default context.
- Credentials config
- OAuth2 access token
terraform init
terraform plan
terraform apply
Below two Charts with specific release names will be installed.
- Nginx
- Redis
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
my-nginx-release default 1 2022-10-10 20:26:18.274088 +0800 CST deployed nginx-13.2.10 1.23.1
my-redis-release default 1 2022-10-10 20:32:31.556624 +0800 CST deployed redis-17.3.4 7.0.5
terraform destroy
https://registry.terraform.io/providers/hashicorp/helm/latest/docs
Refer to my Emissary example