-
Notifications
You must be signed in to change notification settings - Fork 63
Plan/apply fails when namespace does not yet exist #57
Comments
Hi @Starefossen, TL;DR; This is a known limitation and should not manifest anymore when using local planning, which is being worked on in this PR: #41 What you are describing is unfortunately a known limitation of using server side planning. It's mentioned in the blog post where we announced the provider under "Limitations" https://www.hashicorp.com/blog/deploy-any-resource-with-the-new-kubernetes-provider-for-hashicorp-terraform/ The issue here is that the provider, when used in server side planning mode, makes dry-run API calls to the K8s API to make sure the resource is configured correctly and also to get default values of missing attributes. When two or more resources are involved in an operation, Terraform schedules all of the Plan actions before all of the Apply actions. This means that the dry-run call for the ConfigMap resource is done before any of the Apply calls are made. As such the Namespace is not yet present on the API side and causes the dry-run call for the ConfigMap to fail. Unfortunately there is no way to address this problem when using server-side plannign without reordering the sequence of Plan / Apply call that Terraform itself makes to the provider for each resource. The problem should not be present when using local planning, once PR #41 will be merged. |
so this renders the kubernetes provider in some terms usless until #41 is ready? |
It is indeed severely limited until we finish work on #41.
It is currently blocked by some issues with Terraform’s own type system
being a bit too restrictive. We are exploring options to circumvent that.
It’s likely going to take a few more weeks.
On Thu, Sep 24, 2020 at 11:06 PM dirien ***@***.***> wrote:
so this renders the kubernetes provider in some terms usless until #41
<#41>
is ready?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#57 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIL5G3Y7EKYEQPNF3FT5Y3SHORCXANCNFSM4NWGTHAA>
.
--
— Sent from my phone.
|
Just to provide an example the inverse of this, I have a terraform module that creates the namespace, then creates the objects inside that namespace using the kubernetes provider, ideally for a decent developer experience, I should be be able to do one of two things:
A specific use case for this:
The problem comes when they are both in the same namespace as they are part of the same application suite, but secret is for a subscriber and the other secret is for the publisher. So one resource will leverage the module and create the namespace while the other will error out (since the namespace already exists). I could remedy this by creating a 1:1 mapping of namespaces and microservices, however to simplify billing reports, I want both the publisher and the subscriber in the same namespace. Here is the terraform module code I am using that causes this race condition:
|
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
Terraform Version and Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
What should have happened?
Expected the plan/apply to work where it first creates the namespace as defined and then additional resources within it.
Actual Behavior
What actually happened?
Steps to Reproduce
Use the above example.
Important Factoids
References
Community Note
The text was updated successfully, but these errors were encountered: