Skip to content

Commit

Permalink
fix: add new partition to arn generation (#3574)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaythapa committed Apr 3, 2024
1 parent c612d4d commit 3856796
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions samtranslator/translator/arn_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ def _region_to_partition(region: str) -> str:
"us-isob": "aws-iso-b",
"us-gov": "aws-us-gov",
"eu-isoe": "aws-iso-e",
"us-isof": "aws-iso-f",
}
for key, value in region_to_partition_map.items():
if region_string.startswith(key):
return value

# Using the ${AWS::Partition} placeholder so that we don't have to add new regions to the static list above
if "iso" in region_string:
return "${AWS::Partition}"

return "aws"


Expand Down
2 changes: 1 addition & 1 deletion tests/translator/test_arn_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setUp(self):
("us-isob-east-1", "aws-iso-b"),
("eu-isoe-west-1", "aws-iso-e"),
("US-EAST-1", "aws"),
("us-isof-east-1", "${AWS::Partition}"),
("us-isof-east-1", "aws-iso-f"),
]
)
def test_get_partition_name(self, region, expected):
Expand Down

0 comments on commit 3856796

Please sign in to comment.