Hi fellow `pulumi` experts and practitioners, as w...
# general
d
Hi fellow
pulumi
experts and practitioners, as we implemented our
pulumi
automation without interacting with
pulumi CLI
, we have encountered the following challenges. If there is any common interests in the community of going over these obstacles, we will highly appreciate anyone could share your experience about the following: • How do we import existing resources (not created by
pulumi
) into an established
pulumi
stack? • How do we get the physical name out of a resource instance, and use it in another resource? The name of a resource instance is a
pulumi.output.Output
in Python, which disallows us to use it in subsequent concatenation of building our resource naming convention. • If some
pulumi
managed resources get removed/modified by someone without going through our pulumi program, how should we manage such situations and keep them in sync? Many thanks. @narrow-wall-86026 @steep-sunset-89396
s
Hey hey Hey @delightful-jelly-17346 1. if you run
pulumi import ...
that should do it. For each resource type you'd like to import, check the documentation page and at the bottom you will usually fund the correct import syntax. 2. If you want the actual cloud resource name (ie, the physical name), you need to use one of the properties as the result of creating the resource.Look at this example and how
bucket.id
is used to export the actual bucket name.
On the last point, you can uncover modified resources by running
pulumi preview --refresh
which will retrieve the latest resource state from your cloud env. Then, you should either 1. patch your code to match the modified in the cloud and run the previous command above to ensure there are no changes. And then appy those changes with
pulumi up --refresh
which should also result in no changes. 2. simply run
pulumi up --refresh
to discard changes present in the cloud and use the current source code as the desired state for those resources. Pulumi will then do its best to revert those changes (ie, update the cloud resources)
d
Thanks Aurelien, I will give them a go:)
n
Hey Wilson, would it make sense to have a follow-up next week? You can invite the team to join the zoom if you'd like.