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

fix: prevent inconsistent planning

Open zenobios opened this issue 2 years ago • 8 comments

This PR fixes the issue reported in #162 by resetting yaml_body_parsed and yaml_incluster in case yaml_body has been changed.

zenobios avatar Aug 09 '22 14:08 zenobios

@gavinbunney hope you're doing well. Any chance to review this PR please ?

barryib avatar Sep 29 '22 23:09 barryib

@gavinbunney I see this change from @zenobios is still pending from some time ago

Would that be possible to be reviewed in the short term? I am suffering exact same issue and believe it could be solved with this change in place

Thanks in advance

nestor-lobo-work avatar Dec 14 '22 22:12 nestor-lobo-work

@gavinbunney blocked on this issue. Can we please review it ? Thanks!

AmitKatyal-Sophos avatar Dec 15 '22 09:12 AmitKatyal-Sophos

@zenobios the actual issue is in the terraform ? Why NewValueKnown for the "yaml_body" key is returning false ? It should have returned true right ?. If any change in the yaml body is not working, then very basic use-case of update of the manifest is not working. Am I missing something here ?

AmitKatyal-Sophos avatar Dec 15 '22 12:12 AmitKatyal-Sophos

@nestor-lobo-work creating the resource using the templatefile seems to be working fine.

resource "kubectl_manifest" "argocd_apps" { for_each = XXXXX yaml_body = templatefile("${path.module}/manifests/apps.yaml", { }) wait = "true" }

AmitKatyal-Sophos avatar Dec 15 '22 14:12 AmitKatyal-Sophos

I built it locally including that fix, however it still failed due to inconsistent plan.

tamirsagi avatar Feb 21 '23 07:02 tamirsagi

Thanks @zenobios for you work on this. It seems to work for me when template variables are updated from other resources. I've forwarded the pull request here https://github.com/alekc/terraform-provider-kubectl/pull/46

Adphi avatar Sep 19 '23 11:09 Adphi

Released in "2.0.3-rc2". Please test if that version covered your usecases.

terraform {
  required_providers {
    kubectl = {
      source = "alekc/kubectl"
      version = "2.0.3-rc2"
    }
  }
}

Cheers

alekc avatar Sep 20 '23 12:09 alekc