https://pulumi.com logo
Title
b

best-horse-36919

03/15/2023, 3:11 PM
I've added new codes, and want to add this resource to pulumi stack. How can I do this?
e

echoing-dinner-19531

03/15/2023, 3:12 PM
pulumi up
That will run the program and create any new resources it now declares
b

best-horse-36919

03/15/2023, 3:14 PM
But it will also try to create resources on the cloud too, correct?
I just want to add resources into pulumi stack, without interfering with cloud infrastructure.
e

echoing-dinner-19531

03/15/2023, 3:15 PM
That's an odd scenario. You want to update state to declare resources that don't yet exist? That's not how stacks are meant to be used.
b

best-horse-36919

03/15/2023, 3:16 PM
To be clear, I have some resources I have created using AWS management console, and wrote my code about these resources myself. And I want pulumi stack to be aware of these resources
b

billions-xylophone-85957

03/15/2023, 3:16 PM
e

echoing-dinner-19531

03/15/2023, 3:16 PM
Ohhh! You want
import
then ^^^|
b

best-horse-36919

03/15/2023, 3:17 PM
Got another question: Let's say I have a Lambda function with tag
foo:bar
applied to it. However, I somehow forgot to add tags to my pulumi code. Will running
pulumi up
remove the tag
foo:bar
applied to the Lambda function?
e

echoing-dinner-19531

03/15/2023, 3:18 PM
Yes, pulumi will try to update the resource to match what the program asked for.
b

billions-xylophone-85957

03/15/2023, 3:19 PM
yes, pulumi will converge the resources to their declarative definitions, unless you're explicitly ignoring some properties with
ignoreChanges
b

best-horse-36919

03/15/2023, 3:22 PM
I have some resources imported using
pulumi import
, but I'm afraid to run
pulumi up
because of unintented changes to my resources on AWS. Is
pulumi import
trustable..?
e

echoing-dinner-19531

03/15/2023, 3:22 PM
import
can not change anything in AWS it only does read-only operations
b

billions-xylophone-85957

03/15/2023, 3:23 PM
verify the changes with
preview
first?
e

echoing-dinner-19531

03/15/2023, 3:23 PM
up
will by default show a preview of what changes it intends to make allowing you to say No and not apply them
b

billions-xylophone-85957

03/15/2023, 3:23 PM
and yes,
import
only changes the Pulumi state, not the actual resources (as well as
refresh
)
b

best-horse-36919

03/15/2023, 3:51 PM
After `pulumi import`ing resources I want, and right after when I run
pulumi preview
, there are tons of changes being displayed..
e

echoing-dinner-19531

03/15/2023, 4:56 PM
Well if your program doesn't match whats been imported then there will be a load of changes. Either accept them, or update your program and keep running preview till it looks like what you want.
b

best-horse-36919

03/15/2023, 5:25 PM
Okay, thanks.. I always copy & paste
import
commands from docs page, but by mistake, I imported a resource with wrong name. How can I remove this resource on pulumi stack?
e

echoing-dinner-19531

03/15/2023, 7:40 PM