mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* fix(cloudformation): clean up, roll back and delete AWS::EC2::VPC like the other EC2 types A CidrBlock change, or a tenancy change other than dedicated to default, replaces the VPC, but the provisioner never recorded the displaced one and had no delete arm, so the old VPC was left behind; in-place Tags, EnableDnsSupport and EnableDnsHostnames changes were not snapshotted, so a later failing resource left the VPC changed and reported rollback as not implemented. Ec2VpcCfnProvisioner now follows Ec2NetworkCfnProvisioner: ReplacementCleanup records the displaced VPC and deletes it after the update commits or restores it on rollback; a prior-state snapshot restores DNS attributes, tags and a dedicated-to-default tenancy change on rollback, eagerly when provision itself fails; and a delete arm through CfnDeletes.safeDelete removes the VPC on stack teardown, tolerating only InvalidVpcID.NotFound so stack-external dependents fail the delete with DependencyViolation, as on AWS. * refactor(cloudformation): use the shared CfnRollback.guarded in the VPC provisioner * fix(ec2): count instances and NAT gateways as subnet and VPC dependents DeleteSubnet and DeleteVpc checked subnets, security groups, route tables, ACLs, gateways and endpoints but not the instances and NAT gateways living in a subnet, so a stack teardown could remove a subnet and its VPC out from under an instance launched into it out of band. Both now fail with DependencyViolation while an instance that is not terminated (shutting-down still holds its interface) or a NAT gateway that is not deleted sits in the subnet, as on AWS. The rollback integration test also pins Boom after the VPC with DependsOn so the scenario cannot pass by ordering alone. * fix(cloudformation): keep the VPC and subnet rollback snapshot until the restore succeeds rollbackUpdate removed the in-place snapshot before restoring; a restore that threw left the resource persisted as UPDATE_FAILED with no prior state for a ContinueUpdateRollback retry. Ec2VpcCfnProvisioner and the pre-existing Ec2NetworkCfnProvisioner now restore first and remove after, as the AgentCore provisioner already did. The describeTags loop shared by Ec2Tags.reconcile and the VPC snapshot moves to Ec2Tags.current. * fix(ec2): count standalone network interfaces and interface endpoints as subnet dependents A subnet is pinned by any network interface in it, not only the ones an instance or NAT gateway owns: a standalone interface from CreateNetworkInterface and an interface or Gateway Load Balancer endpoint keep DeleteSubnet at DependencyViolation on AWS too. The endpoint test that deleted a subnet out from under a live endpoint relied on that state being reachable; it now asserts the refusal and that the published interface ids are unchanged. * fix(cloudformation): wait for terminated on instance delete and resolve VPC properties before creating With real containers an instance is still shutting-down when the stack's instance delete returns, so the subnet delete that follows was refused by the new resident check and the stack ended DELETE_FAILED. The instance provisioner now polls until the instance is terminated or gone, as CloudFormation does. The VPC provisioner created the VPC before EnableDnsSupport, EnableDnsHostnames and Tags were resolved, so a resolution failure left it untracked; the resolves now run first, as the subnet provisioner does. Ec2Tags.current drops reserved aws: keys so a rollback snapshot never tries to write one, and the replacement integration test waits in the stack's own region.