I deploy helm chart with terraform "helm release" I didn't do any change but every…
- User
I deploy helm chart with terraform "helm release" I didn't do any change but every terraform apply create new secret called sh.helm.release.v1.argocd.15, sh.helm.release.v1.argocd.v16 etc
- Assistant
This issue occurs because Terraform detects the change in the
sh.helm.release.v1.argocdsecret (the helm release metadata stored by Helm) and attempts to keep its state up-to-date, causing it to create new secrets while applying the changes.To resolve this issue, you can do the following:
- Configure Terraform to ignore the changes in the secret created by the helm-release:
Add
lifecycleconfiguration to your helm_release block in your Terraform HCL file to ignore the secret creation:
resource "helm_release" "argocd" { # Your existing configuration lifecycle { ignore_changes = [ metadata[0].annotations["meta.helm.sh/release-name"] ] } }This tells Terraform to ignore the specific annotation that stores the release name, which should prevent the automatic creation of new secrets.
- Alternately, you can use the
--skip-crdsflag with the Helm provider in Terraform:
provider "helm" { # Your existing configuration skip_crds = true }This option tells the Helm provider not to install custom resource definitions (CRDs) during the release, which can help mitigate the issue of creating new secrets every time.
Make sure to run
terraform initandterraform applyagain after making these changes.Keep in mind that depending on your use-case, you may need to investigate further and adjust the configuration of your helm_release in Terraform, or you may need to update the specific Helm chart if there are specific conditions within that chart that cause recreation on every apply.
- Configure Terraform to ignore the changes in the secret created by the helm-release:
Add
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.