https://pulumi.com logo
#aws
Title
# aws
s

salmon-ghost-86211

02/24/2020, 9:50 PM
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

white-balloon-205

02/25/2020, 12:10 AM
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

salmon-ghost-86211

02/25/2020, 1:13 PM
Thank you, Luke. That helped a lot.