Does the import feature of Pulumi actually work ? ...
# python
b
Does the import feature of Pulumi actually work ? I've tried over several AWS resources, the latest one being S3 : never managed to import a single thing. I got the following error message after running
pulumi preview
on the S3 example template I attached:
Diagnostics:
pulumipulumiStack (nuage-admin-dev):
error: preview failed
awss3Bucket (nuage-test):
error: Preview failed: importing arnawss3::nuage test Error importing AWS S3 bucket policy: InvalidARNError: invalid ARN
caused by: invalid Amazon S3 ARN, unknown resource type, arnawss3:::nuage-test
w
I believe you can just pass the name
nuage-test
as the import id. Iā€™m surprised the error is so bad - but I expect it will work with the name instead of the ARN.
b
Just passing
nuage-test
instead of the full ARN does not work either. The
pulumi preview
diagnostic returns an error:
Diagnostics:
awss3Bucket (nuage-test):
warning: inputs to import do not match the existing resource; importing this resource will fail
And if I ignore it and
pulumi up
anyway, I get an error:
Diagnostics:
pulumipulumiStack (nuage-admin-dev):
error: update failed
awss3Bucket (nuage-test):
error: inputs to import do not match the existing resource
w
Presumably that error message is accompanied by a diff? You will need to provide matching inputs to be able to import the resource (to avoid unintentionally changing or replacing the resource). See https://www.pulumi.com/docs/intro/concepts/programming-model/#import. Also https://www.pulumi.com/blog/adopting-existing-cloud-resources-into-pulumi/.
b
Thanks @white-balloon-205, you were right : the problem was that I didn't define the
cors_rules
The thing is though, that in Terraform you can import an S3 Bucket into your
.tfstate
without needing to define everything (diff will be calculated later). You can actually use your
.tfstate
to fill the missing values in your template and avoid the diff, which saves a huge amount of time. It's a pretty big issue (IMHO) that you can't do the same thing in Pulumi. I actually had to copy into Pulumi the
cors_rules
from the state I imported into Terraform, as it is quite difficult to list the exact rules with just the AWS Console & Pulumi's docs In terms of UX, it would be great to be able to manually set up some Cloud resources, easily pull the configs using the CLI and then use that as boilerplate to get everything under Pulumi management and extend it programatically from there on
w
Yes - the Pulumi behavior here is different. Either way though - you will need to have a source file that matches what you have deployed - or else you will change what you have deployed in the next update Definitely being able to show you the proposed source code you could use to represent that same thing that is in the cloud would be helpful. This is part of what https://github.com/pulumi/pulumi/issues/1635 is tracking. Please do add any notes there on what you would expect to see here.
šŸ™ 1
šŸ‘ 1