Repository navigation
fix(cloudformation): derive ARN partitions from the region and mint ARNs with the services' builders - #2591
Merged
Conversation
fakecloud-cloudformation: stack, change-set, stack-set, type, hook and
generated-template ARNs and every ARN the resource provisioner mints for
other services take the partition of the stack's region; the
UpdateStackSet default administration role follows the stack set's own
partition, Organizations OUs/policies follow the organization's, and
SAM-synthesized API ARNs use ${AWS::Partition}. Log-group, Lambda
function/alias and layer ARN parsers accept any partition.
- ResourceProvisioner::regional_arn builds the stack-region ARNs; ECS
cluster/service/task definition, Kinesis stream and Step Functions state
machine ARNs come from their service crates' builders.
- CodeDeploy and Elastic Beanstalk ARN copies stay byte-identical to their
service crates, whose builders are private.
- CLOUDFRONT-scoped WAFv2 ARNs use the partition's implicit global region.
- SAM managed-policy ARNs use ${AWS::Partition}.
- arn_partition is replaced by fakecloud_aws::arn::partition_of; redundant
with_partition calls after Arn::global_in are gone; the generated-template
ARN in DescribeGeneratedTemplate goes through Arn::regional.
…ces' builders Provisioners for DynamoDB, RDS, ElastiCache, EFS, Lambda, Step Functions, ECS, ELBv2, Batch, Application Auto Scaling, Auto Scaling, EMR, SageMaker, ACM, ACM PCA, Cognito, Logs, CloudFront, Service Discovery, CodeBuild, CodeCommit, CodePipeline, CodeArtifact, CodeDeploy, Elastic Beanstalk, AppSync and WAFv2 now call those crates' ARN builders, so a stack's resources carry exactly the ARNs the service APIs mint. Organizations are bootstrapped in the stack region's partition and OU/policy ARNs come from the organization. Default KMS key ARNs use fakecloud_kms::kms_key_arn. Regional WAFv2 ARNs now use the `regional/` scope segment.
…anizations, ELBv2 and layers - Batch compute environments and job queues get the service's `compute-environment/<name>` / `job-queue/<name>` ARNs, so the stack's Ref ARN addresses them through the Batch API. - Organizations OUs and policies go through OrganizationState::create_ou, create_policy and attach_policy, so the service's validation and policy type path segments apply and failures carry the API error codes; the resource policy uses the service's id and ARN. - ELBv2 listener and rule ARNs derive from the parent load balancer and listener ARNs through new fakecloud_elbv2::listener_arn and listener_rule_arn helpers the service now shares. - Application Auto Scaling defaults each namespace to its documented service-linked role (EMR to EMR_AutoScaling_DefaultRole) instead of invented names. - Lambda layer version numbers are never reused after a deletion, in the service and the provisioner. - RDS instances, the Auto Scaling service-linked role and the CodeArtifact asset bucket come from their service crates' builders.
… the API - Deleting a stack's last LayerVersion keeps the layer entry, as the API's DeleteLayerVersion does, so a replaced or recreated layer version never reuses a number. - AWS::Organizations::Policy runs CreatePolicy's Type checks first (now shared as fakecloud_organizations::check_create_policy_type), failing with InvalidInputException / PolicyTypeNotAvailableForOrganizationException. - Move the Auto Scaling service-linked role builder above autoscaling_arn's doc comment.
…Athena ARNs with their builders The SNS topic, EventBridge rule and bus, CloudWatch alarm, SSM parameter and Athena workgroup/data catalog provisioners now call the service crates' ARN builders, so a China stack's resources carry the same ARNs the APIs mint. A test pins those and the EFS/Timestream default KMS key ARNs against the services.
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Last PR of the ARN partition campaign (#2569, #2570, #2572, #2574, #2577, #2578, #2580, #2590). With every service now minting ARNs in the region's partition (
aws-cnforcn-*,aws-us-govforus-gov-*, ISO partitions), the CloudFormation provisioner now produces exactly the ARNs the service APIs produce, so stack-created and API-created resources agree (several services key state by ARN).Partition-aware provisioner
extras.rsARNs that were pinned tous-east-1now carry the request region (commercial-region change, AWS-faithful).UpdateStackSetdefaults the administration role in the stack set's own partition. SAM managed policies and integration URIs use${AWS::Partition}.parse_log_group_name, Lambda function/alias/layer ARNs) accept any known partition.Service builders instead of re-formatted ARNs
DynamoDB, RDS (DB instances, clusters, parameter/option groups, proxies), ElastiCache, EFS, Lambda (functions, versions, aliases, layers), Step Functions, ECS, ELBv2 (load balancers, target groups, trust stores, and listeners/rules derived from their parent ARN), Batch, Application Auto Scaling, Auto Scaling, EMR, SageMaker, ACM, ACM PCA, Cognito, Logs, CloudFront, Cloud Map, CodeBuild, CodeCommit, CodePipeline, CodeArtifact, CodeDeploy, Elastic Beanstalk, AppSync, WAFv2, Organizations, SNS, EventBridge, CloudWatch, SSM, Athena, and default KMS key ARNs via the KMS form.
Fidelity fixes in commercial regions (AWS-faithful)
-<uuid>suffix, so the Batch API finds stack-created ones by their ARN.create_ou/create_policy/attach_policy): duplicate names, unsupported/unknown types and malformed content fail with the API's errors; policy ARNs use the service's path segment; the resource-policy ARN matchesDescribeResourcePolicy.regional/segment; CLOUDFRONT scope uses the partition's global region (cn-northwest-1in China).gwy/ARNs._Default; EMR usesEMR_AutoScaling_DefaultRole).Known limitation: state persisted by a cn/gov server before the campaign keeps
arn:aws:rows. No surface changes.Test plan
china_stack_arns_match_the_service_builders(SNS, EventBridge, CloudWatch, SSM, Athena, EFS/Timestream default keys), Organizations OU following the org's partition, WAF regional/CLOUDFRONT, ELBv2 listener derivation, Batch lookup by ARN, Organizations validation errors, layer version numbering, Application Auto Scaling default roles.cargo test -p fakecloud-cloudformation(486),cargo check --workspace --all-targets, clippy-D warnings,cargo fmt --check,scripts/publish-crates.sh --check.Summary by cubic
Finishes the ARN-partition campaign: the CloudFormation provisioner now derives partitions from the request region and mints resource ARNs using the owning services' builders, so stack-created and API-created resources carry identical ARNs.
Partition-aware provisioner
arn:aws; extras pinned tous-east-1now follow the request region (a commercial-region behavior change, AWS-faithful).${AWS::Partition}.Fidelity fixes in commercial regions
-<uuid>ARN suffix so the Batch API finds stack-created ones by ARN.regional/segment and CLOUDFRONT uses the partition's global region.Known limitation: state persisted by a cn/gov server before this campaign keeps
arn:aws:rows; no surface changes.Written for commit 7bce3d7. Summary will update on new commits.