delightful-jelly-17346
05/25/2023, 11:52 PMpulumi
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-89396steep-sunset-89396
05/26/2023, 12:34 AMpulumi 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.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)delightful-jelly-17346
05/26/2023, 12:40 AMnarrow-wall-86026
05/31/2023, 3:57 AM