mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* feat(ec2): EC2 Instance Connect Endpoint control plane CreateInstanceConnectEndpoint, DescribeInstanceConnectEndpoints and DeleteInstanceConnectEndpoint answered UnknownOperation, so Terraform's aws_ec2_instance_connect_endpoint failed at create and the AWS CLI's `ec2-instance-connect ssh --connection-type eice` could not look an endpoint up. They now carry the fields, filters and errors Terraform and the CLI use. Endpoint DNS names are <id>.localhost.floci.io, which public DNS resolves to 127.0.0.1, and each endpoint takes a private address in its subnet. As on AWS, a live endpoint makes DeleteSubnet and DeleteVpc fail with DependencyViolation (a destroy ordered wrongly would otherwise pass here and fail on AWS, and the endpoint's address reservation leaked), and a replayed ClientToken returns the first endpoint instead of creating a duplicate on an SDK or Terraform retry. The tunnel the endpoint serves is a separate change. * fix(ec2): create an EC2 Instance Connect Endpoint under the subnet topology lock Two creates with one ClientToken could both miss the replay scan and make two endpoints, and a DeleteSubnet could land between the subnet check and the save, leaving an endpoint on a subnet that is gone. The create now holds the lock DeleteSubnet holds. The endpoint store is final and comes through the constructor chain like the other stores, and the service test is named Ec2InstanceConnectEndpointServiceTest. * test(ec2): name the exceptions the endpoint race test expects * fix(ec2): return a copy from instance connect endpoint reads Create, Describe and Delete handed back the stored endpoint itself, with its tags written onto it, and Delete then set delete-in-progress on that object. A caller changing a returned endpoint changed the stored one. They now return a copy carrying the current tags. * fix(ec2): scan one region's instance connect endpoints by key on describe Describe read every region's endpoints and kept those whose region field matched, while the ClientToken replay scan picks a region by store key. Describe now uses the key prefix too, so the two agree on what is in a region and describe no longer reads other regions' records. * fix(ec2): compare every creation parameter on an instance connect endpoint ClientToken replay A replayed ClientToken compared only SubnetId, so a retry with other security groups, IpAddressType, PreserveClientIp or tags returned the first endpoint as if it matched. Each is now compared after defaults are applied and a difference is IdempotentParameterMismatch, as the egress-only internet gateway create does. Tags are compared as the create request carried them, so a later CreateTags does not turn a retry into a mismatch. * test(ec2): drive instance connect endpoints over the EC2 Query wire The service test called Ec2Service directly, so nothing covered the query handler: SecurityGroupId.N and TagSpecification.N parsing, the ClientToken echo, and the Create, Describe and Delete response envelopes. The integration test creates, replays, describes and deletes an endpoint through the HTTP endpoint and reads each result back with a separate Describe. * fix(ec2): validate instance connect endpoint requests before answering DryRun CreateInstanceConnectEndpoint answered DryRunOperation before checking the subnet, IpAddressType or security groups, and Describe and Delete ignored DryRun and acted on the request. Create now validates and then answers DryRunOperation, as RunInstances and ReplaceRoute do, and Describe and Delete check the IDs and filters first, then answer DryRunOperation without deleting anything. * fix(ec2): page DescribeInstanceConnectEndpoints by MaxResults and NextToken MaxResults and NextToken were ignored and every match came back on one page. Describe now returns at most MaxResults endpoints in ID order with a nextToken for the rest, using the shared opaque-cursor pagination, and an unreadable NextToken is InvalidParameterValue as DescribeDhcpOptions answers it. MaxResults is not range-checked against the model's 1-50. * fix(ec2): range-check MaxResults on DescribeInstanceConnectEndpoints and compare replayed security groups as a set The model's InstanceConnectEndpointMaxResults allows 1 to 50, but a sent 0, negative or larger value was served. It is now InvalidMaxResults, as DescribeTags and DescribeEgressOnlyInternetGateways refuse values outside their own ranges; an omitted MaxResults still returns every match. A test now pins that a ClientToken replay naming the same security groups in another order returns the first endpoint. * docs(ec2): name instance connect endpoints among the private address holders privateIpsInUse and privateIpsHeldOnVpcNetwork count the addresses EC2 Instance Connect Endpoints hold, but their comments listed only instances, network interfaces and NAT gateways. * test(ec2): refuse a NAT gateway the private address an instance connect endpoint holds CreateNatGateway with a PrivateIpAddress an EC2 Instance Connect Endpoint holds answers InvalidIPAddress.InUse, and the address is free again once the endpoint is deleted. Nothing covered the endpoint's share of the in-use scan before. * fix(ec2): copy each creation tag of an instance connect endpoint The copy constructor copied the creationTags list but shared its Tag objects with the stored endpoint, and the create stored the request's own Tag objects. Changing a tag on a returned endpoint, or on the list passed to the create, changed the saved creation parameters, so a retry with the same ClientToken and the original tags failed with IdempotentParameterMismatch. Copy each Tag when saving and when returning a copy. * fix(ec2): reject an unknown DescribeInstanceConnectEndpoints filter before scanning An unknown filter name was rejected only while testing it against an endpoint, so with no endpoints, or when an earlier filter excluded them all, the bad name succeeded silently. Check every name up front through requireSupportedFilters, as DescribeVpcs and DescribeVpnGateways do, with the same InvalidParameterValue. * fix(ec2): resolve an instance connect endpoint's interface in DescribeNetworkInterfaces CreateInstanceConnectEndpoint published an interface ID in networkInterfaceIdSet that DescribeNetworkInterfaces answered with InvalidNetworkInterfaceID.NotFound, so a client could not read the endpoint's private address or security groups from it. Build the interface from the endpoint in the describe path, as the NAT gateway and interface VPC endpoint arms already do: a requester-managed ec2_instance_connect_endpoint interface with the endpoint's subnet, VPC, private address and security groups, present while the endpoint exists. Its address is already counted from the endpoint record, so subnet address accounting is unchanged. DeleteInstanceConnectEndpoint also drops the interface's own tags, as DeleteNatGateway does. * fix(ec2): name an instance connect endpoint interface's groups from the account it is read for The explicit-account DescribeNetworkInterfaces overload scanned the named account's endpoints but looked their security group names up under the ambient request account, so a caller in another account got the groups back without names. Read the group for the same account, as natNetworkInterfacesOf reads its subnet. * test(ec2): keep another account's instance connect endpoint interface out of DescribeNetworkInterfaces An endpoint created in one account is NotFound by NetworkInterfaceId and absent from an unfiltered list for another account, and still visible to its own. * fix(ec2): accept exactly AWS's DescribeInstanceConnectEndpoints filters The DescribeInstanceConnectEndpoints reference lists instance-connect-endpoint-id, state, subnet-id, tag:<key>, tag-key, tag-value and vpc-id. Implement tag-value (any tag's value in the filter values, as the other EC2 describe calls match it) and stop accepting availability-zone and owner-id, which the reference does not list; they are now refused as InvalidParameterValue like any unknown filter. * refactor(ec2): build NAT gateway and instance connect endpoint interfaces once natNetworkInterfacesOf and instanceConnectEndpointNetworkInterfacesOf set up the same requester-managed interface with one primary address; both now call requesterManagedInterface. Their two DescribeNetworkInterfaces arms, identical but for the interfaces they walk, become one arm over NAT interfaces then endpoint interfaces, the order the two arms ran in. No behaviour change. * test(ec2): share a mock-mode Ec2Service builder in the test fixtures Ec2ServiceFixtures.mockModeService() in the shared testing package builds the mock-mode Ec2Service over in-memory storage that Ec2InstanceConnectEndpointServiceTest built privately, and that class now uses it. The other classes with their own copy move to it separately. * docs(ec2): count the three InstanceConnectEndpoint operations in the service matrix