https://pulumi.com logo
Title
e

enough-painter-7423

03/29/2023, 3:25 PM
Hi all, I'm working on some refactoring of my Pulumi project. How can I rename the
name
field of
Pulumi.yaml
gracefully? If I just modify the field in the file with Vim, that results in changing all URNs and recreating all the existing resources
$ cat Pulumi.yaml            
name: Infrastructure
runtime: dotnet
description: my infrastructure
V
name: NetworkInfra
runtime: dotnet
description: my network infrastructure
l

little-cartoon-10569

03/29/2023, 7:00 PM
I've never used it though, don't know exactly how it'll work. At a guess, you'll need to rename each stack.
c

calm-cat-43230

03/29/2023, 7:27 PM
We have limited experience with Pulumi using S3 as a backend; I’m not sure how namespacing/changing projects via
stack rename
works in that case. The (long) way we’ve done this is roughly: • export stack to json • change project name in yaml • find/replace old proj name --> new proj name in json • import stack • update config (old values are namespaced to the old stack name still) Unfortunately this has to be done on a stack-by-stack basis, so not fun when you have lots of envs. Would be great to know the way to use
stack rename
with just an S3 bucket. Maybe it’s just
project/stack
? 🙂 I guess I could’ve tried that first…
l

little-cartoon-10569

03/29/2023, 7:29 PM
The docs say "fully-qualified stack name", which would be project/stack for local stacks.
c

calm-cat-43230

03/29/2023, 7:53 PM
Thank you — do the docs actually specify that anywhere, by the way? e.g. https://www.pulumi.com/docs/intro/concepts/stack/ doesn’t make that clear to me. It’s very helpful!
c

calm-cat-43230

03/29/2023, 7:54 PM
(I mean, the project/stack standard. I actually never thought of using the s3 backend as “local”, so that’s good to know as well.)
(That project/stack standard also isn’t clear to me from the
stack rename
doc link, fwiw. But thank you!)
l

little-cartoon-10569

03/29/2023, 7:56 PM
Yes, it's not clear, I'm inferring it from this line:
You can also rename the stack’s project by passing a fully-qualified stack name as well.
c

calm-cat-43230

03/29/2023, 8:06 PM
Thank you!
e

enough-painter-7423

04/01/2023, 8:01 AM
Has anybody had any success in renaming the
name
field of
Pulumi.yaml
(is it called a "project"?)
$ cat Pulumi.yaml            
name: Infrastructure
runtime: dotnet
description: my infrastructure
V
name: NetworkInfra
runtime: dotnet
description: my network infrastructure
If I just use Vim to modify the field, that results in changing all URNs and recreating all the existing resources. I'm using an S3 backend, fwiw.
pulumi stack rename NetworkInfra/network-infra
threw this error:
error: stack names are limited to 100 characters and may only contain alphanumeric, hyphens, underscores, or periods: "NetworkInfra/network-infra"
e

echoing-dinner-19531

04/01/2023, 9:51 AM
I think this will be fixed in the next cli release