sparse-intern-71089
02/04/2019, 11:10 PMwhite-balloon-205
white-balloon-205
sparse-tiger-67367
02/04/2019, 11:13 PM// 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 ========
Diagnostics:
aws:ec2:NatGateway (NATGateway):
error: aws:ec2/natGateway:NatGateway resource 'NATGateway' has a problem: "allocation_id": required field is not set
sparse-tiger-67367
02/04/2019, 11:14 PMwhite-balloon-205
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.sparse-tiger-67367
02/04/2019, 11:42 PM