terraform-provider-helm: Values modified outside of terraform not detected as changes
Terraform Version
Terraform v0.12.12
Helm provider Version
~> 0.10
Affected Resource(s)
- helm_resource
Terraform Configuration Files
resource "helm_release" "service" {
name = "service"
chart = "service"
version = "0.1.7"
repository = module.k8s.helm_repository_name
set {
name = "image.tag"
value = "latest"
}
}
Expected Behaviour
A diff should be detected if settings of the release are modified outside of Terraform.
Actual Behavior
The helm provider does not detect changes to the release done outside of Terraform.
Steps to Reproduce
terraform apply$ helm get values service image: tag: latest # <-- Value as set in terraformhelm upgrade service service --reuse-values --set image.tag=test$ helm get values service image: tag: test # <-- Value in the deployed release changedterraform apply(Should detect the change done on the release when refreshing the state)... helm_release.service: Refreshing state... [id=service] ... Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 39
- Comments: 20 (1 by maintainers)
Just ran into this, and it is very annoying. For a workaround, I did this:
We found this issue as well. Is there any plan to allow Terraform to override any changes applied outside of the helm_release resource?
I’d also like to “bump” this issue because it’s also impacting us as well.
Thanks @lukli11. One interesting thing i found reading the code is that the provider seems to have implemented this functionality as an experimental feature. I’ll definitely use your workaround with my project and give the experimental feature a try and see if it compares to it. Thanks for sharing.
Code reference: https://github.com/hashicorp/terraform-provider-helm/blob/main/helm/resource_release.go#L738-L818 Reference: https://registry.terraform.io/providers/hashicorp/helm/latest/docs#experiments
@drexler We currently use this workaround in our project.
First, we create a file hash across all yaml files in the chart directory (set in variable
var.chart_path)…… and then add this hash as a value in the helm_release resource:
Hope this helps 😃
Edit: Oh, and we added
reset_values = truein the helm release resource as well, so far that combination has worked quite nicely.I’ve found today it’s not detecting if a service was deleted. Not sure if that’s helm issue though.
I ran into this issue today. Adding a checksum for the
values.yamlfile was my workaround:If edit resources created by helm directly, they also will be skipped, because values/release file not changed
The experimental manifest feature didn’t work as expected but @lukli11 workaround is useful for detecting chart changes. Slick hack! 💯