Hi all, I'm working on some refactoring of my Pulu...
# general
e
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
Copy code
$ cat Pulumi.yaml            
name: Infrastructure
runtime: dotnet
description: my infrastructure
V
Copy code
name: NetworkInfra
runtime: dotnet
description: my network infrastructure
l
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
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
The docs say "fully-qualified stack name", which would be project/stack for local stacks.
c
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
(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
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
Thank you!
e
Has anybody had any success in renaming the
name
field of
Pulumi.yaml
(is it called a "project"?)
Copy code
$ cat Pulumi.yaml            
name: Infrastructure
runtime: dotnet
description: my infrastructure
V
Copy code
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
I think this will be fixed in the next cli release