terraform-provider-helm
terraform-provider-helm copied to clipboard
Larger diff than expected generated when changing helm_release 'set' 'value'
Terraform, Provider, Kubernetes and Helm Versions
Terraform version: v1.2.4
Provider version: v2.6.0
Kubernetes version: v1.23.6
Helm version: version.BuildInfo{Version:"v3.9.0", GitCommit:"7ceeda6c585217a19a1131663d8cd1f7d641b2a7", GitTreeState:"clean", GoVersion:"go1.17.5"}
Affected Resource(s)
- helm_release
Terraform Configuration Files
terraform {
required_version = ">= 1.0.0"
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = ">= 2.8.0"
}
helm = {
source = "hashicorp/helm"
version = ">= 2.4.1"
}
}
}
provider "kubernetes" {
config_path = "~/.kube/config"
}
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}
}
variable "memory" {
type = string
}
resource "helm_release" "test" {
name = "test"
repository = "https://coredns.github.io/helm"
chart = "coredns"
set {
name = "replicaCount"
value = "1"
}
set {
name = "resources.requests.memory"
value = var.memory
}
}
Debug Output
NOTE: In addition to Terraform debugging, please set HELM_DEBUG=1 to enable debugging info from helm.
Terraform log and state file: https://gist.github.com/adcharre/120482e9f4d4bcb5641c49f6fb35f0f1
Panic Output
Steps to Reproduce
terraform apply -auto-approve -var memory=100Miterraform apply -auto-approve -var memory=120Miterraform apply -auto-approve -var memory=100Mi
Expected Behavior
On second and third apply, xxx and yyy would be a number.
helm_release.test: Refreshing state... [id=test]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# helm_release.test will be updated in-place
~ resource "helm_release" "test" {
id = "test"
name = "test"
# (28 unchanged attributes hidden)
- set {
- name = "resources.requests.memory" -> null
- value = "xxxMi" -> null
}
+ set {
+ name = "resources.requests.memory"
+ value = "yyyMi"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
helm_release.test: Modifying... [id=test]
helm_release.test: Modifications complete after 1s [id=test]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
Actual Behavior
On second and third apply:
helm_release.test: Refreshing state... [id=test]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# helm_release.test will be updated in-place
~ resource "helm_release" "test" {
id = "test"
name = "test"
# (27 unchanged attributes hidden)
- set {
- name = "replicaCount" -> null
- value = "1" -> null
}
+ set {
+ name = "replicaCount"
+ value = "1"
}
- set {
- name = "resources.requests.memory" -> null
- value = "xxxMi" -> null
}
+ set {
+ name = "resources.requests.memory"
+ value = "yyyMi"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
helm_release.test: Modifying... [id=test]
helm_release.test: Modifications complete after 1s [id=test]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
On the third apply the follow warning is also seen in the log:
2022-07-11T12:02:27.741+0100 [WARN] Provider "registry.terraform.io/hashicorp/helm" produced an unexpected new value for helm_release.test during refresh.
- .set: planned set element cty.ObjectVal(map[string]cty.Value{"name":cty.StringVal("replicaCount"), "type":cty.NullVal(cty.String), "value":cty.StringVal("1")}) does not correlate with any element in actual
This looks like it might therefore be related to #711 Examining the state file it is clear that the "type" value for the "replicaCount" is now set to null.
Important Factoids
References
- #711
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
I am also hitting this. I would argue that the expected behaviour should be
~ set {
name = "resources.requests.memory"
~ value = "xxxMi" -> "yyyMi"
}
instead of still having a deletion and an addition for that changed value (i.e., when a single value is updated, I believe it should show as "update in-place")
edit: this issue might be a duplicate of https://github.com/hashicorp/terraform-provider-helm/issues/627 and https://github.com/hashicorp/terraform-provider-helm/issues/749
Closing this issue as resolved with https://github.com/hashicorp/terraform-provider-helm/releases/tag/v2.8.0 - in PR https://github.com/hashicorp/terraform-provider-helm/pull/916
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.