While importing existing infrastructure, I've gott...
# getting-started
b
While importing existing infrastructure, I've gotten myself into a bit of a state that I'm not sure how to get out of. If you're interested in the long context of how I got there, see https://github.com/pulumi/pulumi-aws-native/issues/660 , but right now I have a resource that's in the stack but I can't seem to do anything that will cause
pulumi up
to not make changes to it: • If I provide any value for the
listener_arn
field in the auto-generated code, Pulumi attempts to update it via AWS's API and that fails because it has to be set on creation. • If I don't provide
listener_arn
, Pulumi errors out because it's a required field. • If I don't define the resource at all, Pulumi errors out because it would attempt to delete it from AWS (but thankfully
protect=True
) I'd like to either back out of the import or move forward in a no-op way, but I'm not sure how to do either of those. I think my options are 1. Set up
replace_on_changes
to let Pulumi delete and recreate the resource in AWS. Theoretically fine, but since this is in-use infrastructure and I'm just getting this set up for the first time, I'm nervous about this happening correctly. 2. Do some sort of stack edit to remove the imported resource, and try it again but with
aws
instead of
aws-native
. I'm not sure how I would do this, and it seems like the sort of dangerous path that I shouldn't be pursuing as a beginner. 3. Do some sort of stack edit to fix the imported resource so it correctly knows what is set up in AWS and doesn't try to make any changes to it. Similarly sounds risky. Any advice on a path out of this? I haven't yet learned many of the tools for dealing with problems I create in Pulumi. simple smile
b
you can either: • delete it from the stack by grabbing its urn
pulumi state --show-urns
and then delete it
pulumi state delete <urn>
• add the required fields and then set
ignoreChanges
on that field
I would do option 1, then import it with aws classic
b
ah, thanks, that seems good. I'll try that and get back
great, thanks, that was exactly what I was looking for