From c59fee5d352e429309ddce7f8350ef70f2003593 Mon Sep 17 00:00:00 2001 From: Mario Nitchev Date: Fri, 1 Sep 2023 19:45:39 +0300 Subject: [PATCH] EC2: Add missing transitGatewayArn field for CreateTransitGatewayResponse (#6750) --- moto/ec2/models/transit_gateway.py | 6 +++++- moto/ec2/responses/transit_gateways.py | 5 +++-- tests/test_ec2/test_transit_gateway.py | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/moto/ec2/models/transit_gateway.py b/moto/ec2/models/transit_gateway.py index b6e6bfd2d..2805a0367 100644 --- a/moto/ec2/models/transit_gateway.py +++ b/moto/ec2/models/transit_gateway.py @@ -46,6 +46,10 @@ class TransitGateway(TaggedEC2Resource, CloudFormationModel): def owner_id(self) -> str: return self.ec2_backend.account_id + @property + def arn(self) -> str: + return f"arn:aws:ec2:{self.ec2_backend.region_name}:{self.ec2_backend.account_id}:transit-gateway/{self.id}" + @staticmethod def cloudformation_name_type() -> str: return "" @@ -62,7 +66,7 @@ class TransitGateway(TaggedEC2Resource, CloudFormationModel): cloudformation_json: Any, account_id: str, region_name: str, - **kwargs: Any + **kwargs: Any, ) -> "TransitGateway": from ..models import ec2_backends diff --git a/moto/ec2/responses/transit_gateways.py b/moto/ec2/responses/transit_gateways.py index f86afaab3..013ab2528 100644 --- a/moto/ec2/responses/transit_gateways.py +++ b/moto/ec2/responses/transit_gateways.py @@ -64,6 +64,7 @@ CREATE_TRANSIT_GATEWAY_RESPONSE = """