https://pulumi.com logo
#general
Title
# general
p

powerful-ram-56107

09/19/2019, 7:49 AM
Good morning. Yet another question: Is there a way to make
pulumi
"accept" pre-existing objects with the same name/ID as described in the sources into the current stack? I mean similar to
pulumi refresh
, but without the resources being present in the stack already. I imagine a workflow where one does: 1.
pulumi accept
, which writes the objects into the stack as is; strongly suggesting to continue with step 2 afterwards 2.
pulumi up --expect-no-changes
, until the code fits the current stack state again
t

tall-librarian-49374

09/19/2019, 7:58 AM
r

rhythmic-finland-36256

09/19/2019, 7:58 AM
Did you already read about the
import
resource option that allows to specify the id/arn of an existing entity? together with a
pulumi up
this will show you which resources are adopted to the stack instead of creating new ones.
Damn. One second late…
p

powerful-ram-56107

09/19/2019, 11:12 AM
Ah, thanks a lot, both of you! 🙂 So the decision whether to import or not is pushed to the program, interesting. Will play around with that.
BTW, the "import id" for GCP resources is often the
name
, just for the next fellow who comes across this.
g

gray-nest-70702

09/19/2019, 12:59 PM
I'm getting started with Pulumi and have been moving objects around inside my program and importing/reimporting them a lot. During this time, it would be nice to have options for alias-if-exists and import-if-exists so I don't need to redefine aliases as I move objects around or set the import option on all nested objects. The import-if-exists decision is easy for simple objects where the import id is the same as the name but the concept may fall apart as the decision gets more complex. There is some WIP for real-time translations prior to registering a resource so I'll take a look at that when ready. Until then, I wanted to share this concept in case others were thinking about something similar.