terraform-provider-kubectl icon indicating copy to clipboard operation
terraform-provider-kubectl copied to clipboard

[feature] Support ignoring api_version for updates

Open stevehipwell opened this issue 3 years ago • 2 comments

When updating resources it can be useful to update a resource with a new API version, in fact this is a fundamental part of Kubernetes. The current behaviour tries to destroy and re-create a resource when this happens which is bad from a Terraform aspect with cyclic dependencies and bad from a Kubernetes aspect where something is being removed when it could just be updated (made even worse if this happens to be a CRD).

It would be really useful to add an argument to kubectl_manifest that would allow the upgrade to ignore API versions. The logic for this could be internal (e.g. upgrade_apis = true would support going from networking.k8s.io/v1beta1 -> networking.k8s.io/v1) or customizable (e.g. upgrade_apis = ["networking.k8s.io/v1beta1"] would allow the new API version to replace the old API version if it was networking.k8s.io/v1beta1) or a full override (e.g. upgrade_apis = true skipping the API version check).

Thanks for this provider, it's great.

stevehipwell avatar Jun 23 '21 11:06 stevehipwell

Are there any plans to implement this? It is currently preventing us from upgrading Strimzi Kafka operator to higher versions, as the upgrade forces us to upgrade the API version on deployed resources, that are deployed using the kubectl provider.

chreichert avatar Jul 28 '21 06:07 chreichert

@gavinbunney : Sorry for asking again. This feature would be very important for us. Reason is, that when you are forced to update the API version on an already deployed resource (e.g. kafkas.strimzi.io), this is currently not possible. The provider would destroy and recreate the resource, which is nothing you would want, when your active running Kafka cluster in production will be destroyed.

chreichert avatar Jan 31 '22 15:01 chreichert