Terraform-provider-kubernetes: Deployments 'must be replaced' after upgrade to v1.13.1

Created on 3 Sep 2020  ·  6Comments  ·  Source: hashicorp/terraform-provider-kubernetes

Terraform Version and Provider Version

no plan generated with:

Terraform v0.12.26
+ provider.kubernetes v1.12.0

plan to replace all Deployments generated with:

Terraform v0.12.26
+ provider.kubernetes v1.13.1

Affected Resource(s)

  • kubernetes_deployment

Terraform Configuration Files

resource "kubernetes_deployment" "this" {
  metadata {
    name = "deployment-name"
  }

  spec {
    template {
      spec {
        container {
          # ...

          volume_mount {
            mount_path = "/tmp"
            name       = "temp-vol"
          }
        }

        volume {
          name = "temp-vol"
          empty_dir {}
        }
      }
    }
  }
}

Expected Behavior

After upgrading from v1.12.0 to v1.13.1, there should be no plan generated as the configuration has not changed.

Actual Behavior

After upgrading from v1.12.0 to v1.13.1, the following plan was generated:

  # kubernetes_deployment.this must be replaced
-/+ resource "kubernetes_deployment" "this" {
...
                  ~ volume {
                        name = "temp-vol"

                      ~ empty_dir {
                          + size_limit = "0" # forces replacement
                        }
                    }
...

Steps to Reproduce

  1. Set kubernetes provider version constraint to "~> 1.12.0" if you don't already have it, and run terraform init
  2. Set up a kubernetes_deployment, with an empty_dir volume with no size_limit
  3. terraform apply to create the Deployment
  4. terraform plan if you like, to validate that there's no plan generated
  5. Set the version constraint to "~> 1.13" run terraform init again
  6. terraform plan to validate that the Deployment now requires replacement

Important Factoids

Upgrading to a non-major provider version should be backwards-compatible, and not cause resources to be replaced without a config change.

References

Probably caused by either #912 or #983

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
bug

All 6 comments

Of note: another recent occurrence of this issue was https://github.com/hashicorp/terraform-provider-kubernetes/pull/916#issuecomment-666174449 (although that one didn't result in replacements).

This is indeed an issue. Sorry that it slipped through.
A fix is in review already (https://github.com/hashicorp/terraform-provider-kubernetes/pull/985).

Until a new release is cut, you can work around the issue by setting size_limit = "" in config. After the fix is rolled out, the empty value will be ignored by provider entirely.

when is the next release scheduled?

@llamahunter we have one queued up next week, note that Monday is a holiday in the US/Canada

so... the latest provider generates an error if you did the workaround suggested in https://github.com/hashicorp/terraform-provider-kubernetes/issues/984#issuecomment-686615371

Error: spec.0.template.0.spec.0.volume.0.empty_dir.0.size_limit. : quantities must match the regular expression '^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$'

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings