This message was deleted.
# aws
s
This message was deleted.
l
You can use the dependsOn opt, if it's not already inferred. I thought ENIs are, though...
However if you don't need to explicitly define the ENI, then you shouldn't. AWS will create and manage one for you. You can get its ID from the instance's outputs if you need it.
s
yeah I've tried various `CustomResourceOptions`:
dependsOn
,
parent
, etc. Instead of handling that flow above, they offer this preview:
Copy code
Type                         Name                    Plan       Info
     pulumi:pulumi:Stack          infra-dev                          1 warning
     ├─ aws:ec2:NetworkInterface  networkInterface
 +   │  └─ aws:ec2:Instance       instance                create
 -   └─ aws:ec2:Instance          instance.               delete
l
After re-reading: you can't get Pulumi to detach ENIs. There is no support for this sort of thing. You would need to do this yourself. Pulumi can delete it for you, and create a new one...
s
ahhhh I see! But if I hand over the mgmt of making the ENI to Amazon, Amazon will take care of it on replacement?
or it should do so anyway
l
Yes. I've never had an issue with ENIs. They're essentially atomic within the instances.
👍 1
s
so instead of trying something like this to give the instance an EIP: pulumi.com/registry/packages/aws/api-docs/ec2/instance/#network-and-credit-specification-example , I could instead just set something like https://www.pulumi.com/registry/packages/aws/api-docs/ec2/instance/#associatepublicipaddress_nodejs and Amazon should understand iirc
l
I don't see a need for an explicit ENI in that first example. And I don't see a need for a public IP address, either. If you need a specific private IP address, use
privateIp
. If you don't need a specific IP address, don't provide one, let AWS pick one for you. This is much safer.
Assuming that the only things that will connect to your EC2 instance are set up in Pulumi, just get the IP address from the created resource. You hopefully shouldn't have to define the IP address in advance.
s
this has been working great for me!!! thanks @little-cartoon-10569 🙂
👍 1