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

sparse-tiger-67367

02/04/2019, 11:10 PM
Hey I'm working with go/aws and having trouble getting an EIP and NATGateway to work together. I have the EIP being created and the NATGateway taking the EIP's AllocationID as a param but pulumi is blowing up saying the AllocaitonID is a missing argument
w

white-balloon-205

02/04/2019, 11:12 PM
Could you share the error message?
(And if possible, the code snippet?)
s

sparse-tiger-67367

02/04/2019, 11:13 PM
Copy code
// Make an EIP for the NAT Gateway
natEIP, err := ec2.NewEip(ctx, "NATEIP", &ec2.EipArgs{
    PublicIpv4Pool: "amazon",
    Vpc:            true,
})

// Make a NAT gateway
natGateway, err := ec2.NewNatGateway(ctx, "NATGateway", &ec2.NatGatewayArgs{
    AllocationId: natEIP.AllocationId(),
    SubnetId:     publicSubnet.ID(),
}
======== ERROR MESSAGE ========
Copy code
Diagnostics:
  aws:ec2:NatGateway (NATGateway):
    error: aws:ec2/natGateway:NatGateway resource 'NATGateway' has a problem: "allocation_id": required field is not set
The EIP is being created and I can see the allocation id inside the AWS console
w

white-balloon-205

02/04/2019, 11:37 PM
It appears that
natEIP.AllocationId()
is undefined for this type of
Eip
resource. Instead, you need to use
natEIP.ID()
. Can't explain why that is the API design personally - but it is the pattern used here https://pulumi.io/reference/pkg/nodejs/@pulumi/aws/ec2/#example-usage-10 and I tried it in Go and it worked.
s

sparse-tiger-67367

02/04/2019, 11:42 PM
Huh how weird! I'll give it a try, thanks!