<@U05HLGAFTAA> Can you provide an example that min...
# getting-started
s
@gentle-application-59272 Can you provide an example that minimally reproduces the issue with a single Pulumi file and a Pulumi import JSON file with a single entry? It's not clear to me why you would need to export the provider (although I have not done bulk import with a named provider).
g
I should have created the reproducible from the start... sorry The export is just my vain attempt to try to get codegen working, i wanted to export something, anything
s
What cloud are you importing resources from?
g
AWS
s
I wrote a blog post on this subject (which you might already be aware of): https://www.pulumi.com/blog/automating-pulumi-import-to-bring-manually-created-resources-into-iac/ Curious how you are generating the bulk import JSON: Are you using boto3, or did you find a better way e.g. with Resource Manager's API?
g
I have only done any of it by hand so far
s
Ok, so you're doing a proof of concept for import into Pulumi?
g
yep
s
Do you have a ton of different resource types, or is it mostly core things like IAM, EC2, etc.?
g
my client's previous team(s) never put anything into IAC really
mostly vpc, s3, cloudfront, lambda
s
Yup. I came from consulting, so I know how that goes!
g
we are having some true fun
s
Lambda could be a little tricky b/c I don't know how it would handle the
code
param, but check out that blog post if you haven't already. There's a linked GH repo that should give you a starting point that you can expand upon. We'll gladly accept PRs as well as long as they can be tested without undue effort.
g
with terraform i typically ignored anything to do with the code component of lambdas, usually pushing up a blank/empty zip
then used other CICD controls to properly populate the lambda
recon it matters if resources names (in this case a route53 record) have dots' like
new aws.route53.Record('<http://mysite.com|mysite.com>')
or should i stick to
mysite-com
s
You know you can export code from the Lambda service in the console, right?
g
Yeah sure i didn't mean that, what i meant to say is that typically when dealing with lambdas I let developers define their own for their api gateways using whatever tool they wanted, eg serverless or sam, or I defined more foundational lambdas such as sqs triggered lambdas via terraform but I set up separate CICD pipelines for those lambdas such that developers could develop them without having to run terraform
thus terraform never was involved with lambda code, which is how i'll be dealing with the lambdas on this project with pulumi. No idea how import will behave ofcourse
it might try to pull the code as a local zip, who knows
I think the lesson here is that IAC import is always hell
hey @stocky-restaurant-98004 one more queestion about this; does the codegen typically output the generated code to STDOUT or into index.ts?
s
There's a file output option, but STDOUT is the default.
g
ok so that changes things, the issue with the variable name then must not have anything to do with what's in my files, it's just a label
i presumed it was inspecting index.ts trying to locate the variable statically, to then insert the resources under it
that's very useful to know