I have some AWS resources (IoT core, S3 bucket, Co...
# aws
I have some AWS resources (IoT core, S3 bucket, Cognito user pool, ...) that are built using AWS console by other people in my company. These resources are built for developement evnrionment. Now I’m going to use pulumi to clone and modify these resources to generate the same set of resources for the staging environment. The way I do this is as follows: 1. Run
pulumi import <development_environment_resources>
to generate the python code for the resources. 2. Modify the python code to make it sutible for the staging environment. 3. Run
pulumi stack --show-urns
to see the URN of the imported development environment resource. 4. Run
pulumi state delete --force <development_environment_resource_urn>
to delete the imported resource. Because I don’t need it. 5. Run
pulumi up
to deploy the staging environment resource that I created in step 2. Does there exist any more convenient way for doing this? I wish I don’t have to do step 3 and 4. Because I just want to see the generated code in step 1.
Generated code isn't ideal, but you could make use of bulk import https://www.pulumi.com/docs/guides/adopting/import/#bulk-import-operations to get some structure, but I prefer to write the code myself and then map imported resources to my code instead of having pulumi generate it.