banzaicloud/terraform-provider-k8s

Provider should behave the same way as kubectl apply works

rishi-anand opened this issue · 3 comments

Is your feature request related to a problem? Please describe.

If a resource exists then it should be patched in create call as well.

Describe the solution you'd like to see

If a resource exists, it should be modified existing content. So that desired state is what is there in the content.

Describe alternatives you've considered

Additional context

k8s_manifest.nginx-deployment[5]: Creation complete after 18s [id=default::apps/v1::Deployment::nginx]
Error: priorityclasses.scheduling.k8s.io "nginx-critical" already exists
  on k8s_manifest.tf line 9, in resource "k8s_manifest" "nginx-deployment":
   9: resource "k8s_manifest" "nginx-deployment" {

Error: configmaps "log-parser-config" already exists
  on k8s_manifest.tf line 9, in resource "k8s_manifest" "nginx-deployment":
   9: resource "k8s_manifest" "nginx-deployment" {

rishi@Spectro k8s (brownfield) $ 

I can work on the dev changes to patch resource.

pepov commented

Hey, thanks for the report! I beleive the correct workflow for existing resources is to import them first, or am I missing something?

@pepov, You are right!
I made a few changes in forked repo of banzai in which I added multi resource support in manifest and then I faced this issue as few resource was existing.