Fix deprecated kubernetes_namespace resource - #19
Open
dhavaln-able wants to merge 2 commits into
Open
dhavaln-able wants to merge 2 commits into
dhavaln-able wants to merge 2 commits into
Conversation
kubernetes_namespace is deprecated in favor of kubernetes_namespace_v1 as of the hashicorp/kubernetes provider v2.0 naming convention change. Switch the resource type and its depends_on reference in helm.tf, and bump the declared provider constraint from >= 1.10.0 to >= 2.0 since kubernetes_namespace_v1 does not exist in older provider versions.
Without this, Terraform treats kubernetes_namespace -> kubernetes_namespace_v1 as a brand new resource and plans to destroy the existing namespace (and everything running in it) before recreating it. The moved block makes this a transparent state migration instead. moved blocks require Terraform >= 1.1, so bump required_version accordingly (was >= 0.13).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Terraform's kubernetes provider deprecated the
kubernetes_namespaceresource in favor ofkubernetes_namespace_v1(part of the v2.0 provider naming convention change, where several resources gained_v1suffixed replacements). Consumers of this module currently see:Changes
namespace.tf:kubernetes_namespace→kubernetes_namespace_v1helm.tf: update the matchingdepends_onreferenceversions.tf: bump the declaredkubernetesprovider constraint from>= 1.10.0to>= 2.0, sincekubernetes_namespace_v1doesn't exist in provider versions before 2.0 — the old constraint would let someone pin an incompatible provider version and hit a hard error instead of just a warningnamespace.tf: added amovedblock (kubernetes_namespace.kubernetes_efs_csi_driver→kubernetes_namespace_v1.kubernetes_efs_csi_driver). Without it, Terraform treats the resource-type change as a brand new resource and plans to destroy the existing namespace (and everything running in it) and recreate it on upgrade — themovedblock makes this a transparent state migration instead, so existing consumers see no diff on the namespace itself.versions.tf: bumprequired_versionfrom>= 0.13to>= 1.1, sincemovedblocks require Terraform 1.1+Test plan
terraform planagainst a cluster consuming this module no longer shows the deprecated-resource warningterraform planon an existing deployment shows no changes to the namespace itself (themovedblock should make this a no-op state migration, not a destroy/recreate)