From 4526a43d1ad32e8843aea191ea5fc1e16f8d68fc Mon Sep 17 00:00:00 2001 From: Daniel Fangl Date: Fri, 9 Aug 2024 09:04:53 +0200 Subject: [PATCH] Fix SSM ARN generation and elastictranscoder arn acceptance --- moto/elastictranscoder/responses.py | 3 ++- moto/ssm/models.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/moto/elastictranscoder/responses.py b/moto/elastictranscoder/responses.py index 99fc116c6d76..8ea14c88ce05 100644 --- a/moto/elastictranscoder/responses.py +++ b/moto/elastictranscoder/responses.py @@ -6,6 +6,7 @@ from moto.core.responses import BaseResponse from .models import ElasticTranscoderBackend, elastictranscoder_backends +from ..utilities.utils import ARN_PARTITION_REGEX class ElasticTranscoderResponse(BaseResponse): @@ -45,7 +46,7 @@ def create_pipeline(self) -> TYPE_RESPONSE: thumbnail_config = self._get_param("ThumbnailConfig") if not role: return self.err("Role cannot be blank") - if not re.match("^arn:aws:iam::[0-9]+:role/.+", role): + if not re.match(f"{ARN_PARTITION_REGEX}:iam::[0-9]+:role/.+", role): return self.err(f"Role ARN is invalid: {role}") if not output_bucket and not content_config: return self.err( diff --git a/moto/ssm/models.py b/moto/ssm/models.py index bde58b117ba1..4004bc29d57f 100644 --- a/moto/ssm/models.py +++ b/moto/ssm/models.py @@ -1187,7 +1187,7 @@ def __init__(self, region_name: str, account_id: str): self.windows: Dict[str, FakeMaintenanceWindow] = dict() self.baselines: Dict[str, FakePatchBaseline] = dict() - self.ssm_prefix = f"arn:aws:ssm:{self.region_name}:{self.account_id}:parameter" + self.ssm_prefix = f"arn:{self.partition}:ssm:{self.region_name}:{self.account_id}:parameter" def _generate_document_information( self, ssm_document: Document, document_format: str