mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* fix(ec2): report NAT gateways as zonal and honor PrivateIpAddress The Terraform AWS provider reads network_interface_id, private_ip and public_ip from a NAT gateway only when it is reported with availabilityMode zonal. Floci never sent availabilityMode, so all three stayed null. Every gateway Floci creates sits in one subnet, so the responses now say zonal. Floci has no regional NAT gateways. A regional request that named only its VPC failed on the missing subnet, and one that also named a subnet got a zonal gateway, through both CreateNatGateway and AWS::EC2::NatGateway. Both now refuse AvailabilityMode regional with UnsupportedOperation. Any other value except zonal, such as Regional, fails with InvalidParameterValue instead of creating a zonal gateway. Once Terraform reads private_ip back, the gateway has to hold the address it was asked for. private_ip forces a new gateway, and CreateNatGateway ignored PrivateIpAddress, so a config that set it would plan a replacement on every run. CreateNatGateway and AWS::EC2::NatGateway now give the gateway's interface the requested address, checked by the same rules as RunInstances: inside the subnet, not reserved and not in use. A changed PrivateIpAddress replaces the CloudFormation resource, as it is createOnly. A gateway has its primary address only, so SecondaryAllocationIds, SecondaryPrivateIpAddresses and SecondaryPrivateIpAddressCount are refused with UnsupportedOperation instead of being dropped. AWS::EC2::NatGateway also sets EniId, the gateway's primary interface, which Fn::GetAtt resolved to the literal "Nat.EniId" although the gateway has had a real interface since #5622. Closes #6767 * fix(ec2): take no VPC network lease for a NAT gateway's requested address DeleteNatGateway never returns a lease, so the one CreateNatGateway took for its PrivateIpAddress kept the address from automatic allocation after the gateway was gone. Check that the address is free the way CreateNetworkInterface does, without the lease; automatic allocation already steps around addresses a stored NAT gateway holds. Ec2NatGatewayAddressIntegrationTest now sends its requests through the shared Ec2Requests.ec2 instead of its own copy.