terraform-provider-kubernetes
terraform-provider-kubernetes copied to clipboard
Add ForceNew: true to controller field in IngressClass resource
Description
This PR fixes an issue where changes to the controller field in the IngressClass resource fail because it is immutable in Kubernetes (Kubernetes API). When attempting to update the controller value, Kubernetes rejects the change with an error:
spec.controller: Invalid value: "new-controller": field is immutable
The fix adds the ForceNew: true attribute to the controller field. Doing so makes sure that every change to the controller value forces Terraform to recreate the resource.
Acceptance tests
- [x] Have you added an acceptance test for the functionality being added?
- [x] Have you run the acceptance tests on this branch?
Output from acceptance testing:
make testacc TESTARGS='-run=TestAccKubernetesIngressClassV1_ControllerImmutable'
==> Checking that code complies with gofmt requirements...
go vet ./...
TF_ACC=1 go test "/home/saad/nine-Repos/PT-Repo/terraform-provider-kubernetes/kubernetes" -v -vet=off -run=TestAccKubernetesIngressClassV1_ControllerImmutable -parallel 8
-timeout 3h
=== RUN TestAccKubernetesIngressClassV1_ControllerImmutable
=== PAUSE TestAccKubernetesIngressClassV1_ControllerImmutable
=== CONT TestAccKubernetesIngressClassV1_ControllerImmutable
--- PASS: TestAccKubernetesIngressClassV1_ControllerImmutable (2.74s)
PASS
ok github.com/hashicorp/terraform-provider-kubernetes/kubernetes 2.774s
Release Note
Release note for CHANGELOG:
`Fix: Add ForceNew to the controller field of IngressClass to handle immutability and ensure resource recreation when controller value changes.`
References
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
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement
Learn more about why HashiCorp requires a CLA and what the CLA includes
Have you signed the CLA already but the status is still pending? Recheck it.
Hi, is there anything we can do to speed things up here? We would like to do some changes to ingress classes deployed on our k8s clusters and this change would help us.
Could we have this somehow reviewed, please?