-
Notifications
You must be signed in to change notification settings - Fork 29
Please update the helm chart terraform module to implement repository #30
aziz-shoko edited this page May 9, 2022
·
1 revision
Hello everyone, this wiki is for deprecating the local exec provisioner that we used to add the helm repo. (deprecating this code of block)
resource "null_resource" "grafana_repo" {
provisioner "local-exec" {
command = "helm repo add grafana https://grafana.github.io/helm-charts --force-update"
}
}
- First we have to get the source code for terraform-helm-chart
git clone git@github.com:fuchicorp/terraform-helm-chart.git
- Then inside the terraform-helm-chart directory, navigate to main.tf and add the repository block of code as shown in the picture below
This allows the helm resource to look for the helm chart from a remote repo
- In order to make our code dynamic, we also have to add the proper variables in variables.tf file. Example is shown below
- Next comes the testing part, in order to test our changed code, we simply have to use the module block and have the source point to the terraform-helm-chart directory. This can be done in many ways. I decided to use wikijs as an example and the picture is shown below.
- With this method, the helm repo is no longer needed to be downloaded on the local machine. Thus when defining the deployment path, you just need to add helm chart name itself. Picture of it is shown below and here is a useful link
- After all that, simply add the char_repo under the module block and make it dynamic by also adding the necessary variables
Now if you want to use a certain remote helm chart, simply provide the url in the repository variable in common_tools.tfvars
Useful links
https://stackoverflow.com/questions/69610032/terraform-helm-chart-not-found-in-repo-but-work-in-cli
https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release#repository