Svc update: spec.clusterIP: Invalid value: "": field is immutable
mygithubthrowaway opened this issue · 4 comments
Describe the bug
When I try to update a svc resources, for instance adding a label under spec.selector I encoured this error:
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
k8s_manifest.apply_my_svc: Modifying... [id=terraform-test::v1::Service::my-svc]
Error: Service "my-svc" is invalid: spec.clusterIP: Invalid value: "": field is immutable
on main.tf line 33, in resource "k8s_manifest" "apply_my_svc":
33: resource "k8s_manifest" "apply_my_svc" {
Steps to reproduce the issue:
provider "k8s" {
config_context = var.kube_context
}
data "template_file" "my_svc" {
template = file("${path.module}/manifests/mysvc.yaml")
vars = {
name = var.name
}
}
resource "k8s_manifest" "apply_my_svc" {
depends_on = []
content = data.template_file.my_svc.rendered
namespace = var.namespace
}
Expected behavior
The cluster ip should be skipped cause it's a kube dynamic object
Version: 0.8.4
@mygithubthrowaway thanks for reporting.
We've been discussing a general solution to this, but short term solution is to add a check specifically for service objects. Also if you are looking to contribute don't hesitate!
Hi @pepov thanks for you kind reply!
Unfortunately I'm not so able with golang, I just read you patch and now I understand what was the right change do it.
Thanks for carrying it!
Wow, just tested the 0.9.0 version and now is working well! thanks!
@mygithubthrowaway yeah, after rethinking I've decided to go with the generic solution, glad that it worked for you!