-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail-fast when a program attempts to create an object that already exists. #2926
Comments
I would advocate for fail-fast behavior with any kind, not just namespace. |
As noted on #2948, the upsert behavior can also cause pulumi to silently delete a resource the user was intending to rename |
Another variation: #2227 (comment) |
To summarize, there's various ways to (inadvertently) have two Pulumi resources pointing to the same Kubernetes object. Whether by changing the type of resource (e.g. Normal resource replacement is not relevant here, because the before/after resources have a different URN. That is, unless one applies an alias (and that would help with the name change only). The problem happens specifically in SSA mode because the creation of the replacement doesn't fail as it would in CSA mode. #2926 suggests one possible solution, that is to fail-fast during create, but users do like the upsert feature (see comment). Another solution based on reference counting is discussed in pulumi/pulumi#15982. |
I was helping a user get started with an EKS project and they encountered an error on destroy that was confusing to them:
namespaces "kube-system" is forbidden: this namespace may not be deleted.
What had happened was that in their program, they we creating a
Namespace
resource to manage the built inkube-system
namespace like this:This succeeded on create, probably as an SSA-mode “upsert” on create since the namespace already exists. However, since this is a built-in namespace, the destroy fails.
We should probably have failed fast on the initial
pulumi up
, warning the user that the namespace already exists and suggesting that they need to either import the resource if they want to manage it or just use aNamespacePatch
if they just want to modify some properties of it.The text was updated successfully, but these errors were encountered: