Is it possible to import an existing ALB so that P...
# aws
s
Is it possible to import an existing ALB so that Pulumi manages it? The only example I could find for
import
was on
<https://www.pulumi.com/blog/adopting-existing-cloud-resources-into-pulumi/>
, but I have no idea how to extend that example. I'm confused as to why I would need to specify the cidrBlock for a VPC. Can't Pulumi read that in? What details are required for importing different types of objects?
w
Is it possible to import an existing ALB so that Pulumi manages it?
Yes! I just tried this myself and it imported an ALB I have in my account:
Copy code
const alb = new aws.lb.LoadBalancer("myalb", {
    name: "myalb",
}, { import: "arn:aws:elasticloadbalancing:us-east-1:153052954103:loadbalancer/app/myalb/27eb628e7429acd8"} );
I'm confused as to why I would need to specify the cidrBlock for a VPC.
There are two steps - understanding what to import, and then having a program that specifies the same desired state so that you don't unintentionally change or replace the resource. For the first step, you just need the resource ID, not anything else. If you provide only that, you will be told whether any other inputs are needed when you try to import, and what values they have, so you can add them with the correct values in code. If you don't want to specify a certain input, and don't want Pulumi to try to change the value of that property, you can add it to
ignoreChanges: ["prop"]
. You can then import without specifying that input, but if you want to make changes to that input in the future, you will have to remove it from
ignoreChanges
.
s
Thank you, Luke. That helped a lot.