mirror of
https://github.com/floci-io/floci.git
synced 2026-12-03 10:17:48 -05:00
6ff4700a228b7ac4a79e7f2f2d3edc3151a98edb
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e520166170 |
fix(ec2): protect subnets and VPCs that load balancers use (#5663)
* fix(elbv2): protect subnets and VPCs that load balancers use DeleteSubnet and DeleteVpc returned success while an Application or Network Load Balancer still used the subnet, and DescribeLoadBalancers went on listing a subnet that no longer existed. EC2 now asks each VpcDependencyProvider, implemented by ELBv2, before deleting a subnet or VPC, under the lock CreateLoadBalancer and SetSubnets hold while they record their subnets, and refuses with DependencyViolation. Covered end to end through CloudFormation, including updates, rollbacks and stack deletes that move or delete load balancers, subnets and VPCs. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(cloudformation): record the subnets a load balancer is on A load balancer's attributes named none of its subnets, so once a template stopped naming it, the stack walks had nothing to order it by and deleted it after them, which EC2 now refuses. The provisioner keeps one hidden uses attribute per subnet, refreshed when an update moves the balancer and when a rollback moves it back. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(cloudformation): delete removed resources dependents first The update cleanup deleted removed and condition-disabled resources in reverse map order, before the replacement cleanup. A subnet an earlier update added sits after the load balancer it moved onto it, so removing both deleted the subnet first, and a renamed balancer's old entity still used a subnet the same update dropped. Both now end DELETE_FAILED, since EC2 refuses to delete a subnet a load balancer uses. The removed resources are now walked in dependency order, and a failed delete is tried once more after the replacement cleanup before it is reported. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * docs(ec2): name every ELBv2 load balancer type as a subnet dependency The DeleteSubnet and DeleteVpc rows named only Application and Network Load Balancers, while the check counts every ELBv2 type. The SDK lifecycle test now deletes its subnets and VPC even when an assertion fails. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * test(cloudformation): pin the order of the removed-resource deletes The removal test passed through the retry alone, so it now checks that the load balancer is deleted before its subnet is tried, and that the replaced balancer's old entity goes before the dropped subnet. The provisioner attribute test reads only what Fn::GetAtt can see, with the balancer on subnets. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> |
||
|
|
3cb1643d30 |
fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias (#5744)
* fix(cloudformation): publish content-hashed versions for SAM AutoPublishAlias
Point the alias AutoPublishAlias generates at the Version attribute of
the generated AWS::Lambda::Version, as SAM does, instead of $LATEST,
and name that version as SAM names it: <Function>Version plus the
first ten hex digits of the SHA-1 of the function's code, with
template parameters resolved as a Ref or as ${Name} in an Fn::Sub,
merged with its Environment and MemorySize, as sorted compact JSON
escaped the way Python's json.dumps escapes it. Under
AutoPublishAliasAllProperties the hash covers every property floci
gives the function. A string AutoPublishCodeSha256 takes the hash's
place with its first ten characters. As in SAM, the version is
retained (DeletionPolicy: Retain) unless the function says otherwise,
and version properties of the wrong type are refused.
With the alias on the published version, a template change to the
code names a new version resource, which publishes, and the alias
moves to it, while changes made to $LATEST outside the stack no longer
reach the alias. The $LATEST pin worked around #1987 and #1988: a cold
invoke of a published version timed out, and a warm $LATEST container
served version-qualified invokes. Both are fixed on main.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudformation): hash an applied SnapStart into the SAM version id
SAM adds a function's SnapStart to the hash behind the AutoPublishAlias
version's logical id when its ApplyOn is anything but None, so turning
SnapStart on names a new version, which publishes and gets its
snapshot. Without it a SnapStart function got a different id than SAM
gives it, and changing SnapStart published nothing. Under
AutoPublishAliasAllProperties SnapStart is hashed like the other
properties.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* refactor(cloudformation): resolve SAM destination types with parameterValue
destinationType repeated the parameter lookup parameterValue already
does for the version hash: the stack's value, else the Default. Use the
one helper. A non-string Default still names no destination type.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* docs(cloudformation): describe the SAM version hash in SAM terms
Reword the comments and test names around the AutoPublishAlias version
id to state what SAM and CloudFormation do, rather than how another
project or language implements it.
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
* fix(cloudformation): hash a null SnapStart ApplyOn and state what it changes
SAM leaves SnapStart out of the version hash only when ApplyOn is
missing or "None"; a null ApplyOn is hashed. The check read a null as
"None".
floci does not pass SnapStart to the function, so turning it on
changes the version's logical id but publishes no new version, and
no snapshot is taken.
|
||
|
|
0530ca11ab |
fix(cloudformation): fail stack delete when a managed resource cannot be deleted (#1554)
DeleteStack swallowed every resource-deletion failure and always reported DELETE_COMPLETE. Deleting a stack that owned a non-empty AWS::S3::Bucket therefore "succeeded" while the bucket and its objects were left behind, which diverges from AWS (S3 refuses to delete a non-empty bucket, so the stack must end in DELETE_FAILED). - CloudFormationResourceProvisioner#delete no longer wraps resource deletion in a catch-all; failures propagate to the stack-level handler. The lenient *Safe helpers and the intentional KMS key no-op are preserved. - CloudFormationService#deleteStackResources now records per-resource failures: the resource is marked DELETE_FAILED with a reason and event, remaining resources are still attempted, and the stack settles into DELETE_FAILED (retaining the stack and its exports) instead of being reported as deleted. Resources left in DELETE_FAILED are re-attempted on a subsequent delete, matching AWS retry behavior. This corrects the same silent-success deviation for every managed resource type, not just S3 buckets. Adds a Java integration regression test and AWS CLI compatibility tests covering both the non-empty (DELETE_FAILED) and empty (DELETE_COMPLETE) bucket cases. Fixes #1539 |
||
|
|
1fe6b18987 |
fix(cloudformation): provision EC2 VPC and subnet resources instead of stubbing (#1342)
AWS::EC2::VPC and AWS::EC2::Subnet (and related networking resources) had no provisioner case, so they fell through to the stub branch: CloudFormation reported CREATE_COMPLETE and exported a fake "logicalId-<random>" physical id, but the subnet was never created in EC2. ec2 describe-subnets did not return it and elbv2 create-load-balancer failed with "The subnet ID '...' does not exist". Inject Ec2Service into CloudFormationResourceProvisioner and add cases for VPC, Subnet, SecurityGroup, InternetGateway, RouteTable, SubnetRouteTableAssociation, Route, NatGateway and EIP. Each delegates to the existing Ec2Service create methods and sets the physical id to the real vpc-/subnet-/... id so Ref/exports resolve to resources EC2 and ELBv2 can use. Topological ordering already guarantees parents are provisioned before children. Adds a CloudFormation+EC2+ELBv2 integration test plus AWS CLI and CDK compatibility coverage. Closes #1297 |
||
|
|
7592151cb6 |
fix(cloudformation): resolve changeset by ARN in DescribeChangeSet, ExecuteChangeSet, DeleteChangeSet (#608)
The AWS CLI's passes the full changeset ARN (returned by CreateChangeSet) as the ChangeSetName parameter to subsequent calls. CloudFormationService was doing a direct map lookup by the raw parameter value, which always missed because changesets are stored by short name — causing a 400 ChangeSetNotFoundException and the CLI to crash with . Add resolveChangeSetName() to extract the short name from an ARN before the map lookup, and apply it in describeChangeSet, executeChangeSet, and deleteChangeSet. Closes #606 Co-authored-by: Dixit R Jain <dixitrjain@Mac-1319.lan> |