What’s the typical way of renaming a resource? Spe...
# kubernetes
b
What’s the typical way of renaming a resource? Specifically, let’s say I have:
Copy code
appsv1.NewDeployment(ctx, "myDeployment", &appsv1.DeploymentArgs{
and I want to change it to
Copy code
appsv1.NewDeployment(ctx, "my-deployment", &appsv1.DeploymentArgs{
If I do that, it fails because it says the Deployment already exists with that name (note that I have given it an explicit name, so it is not using autonaming)
g
You should be able to set the
DeleteBeforeReplace
resource option to do this: https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi#DeleteBeforeReplace
b
Would you recommend to set it once to do this replacement and then remove it? Because generally I wouldn’t want this behavior, it’s just this one time as I do the renaming.
Conceptually I just want something like a
pulumi stack rename resource <old name> <new name>
g
Would you recommend to set it once to do this replacement and then remove it?
Yes.
Conceptually I just want something like a pulumi stack rename resource <old name> <new name>
As far as I know, there’s no current support for this.