diff --git a/moto/awslambda/models.py b/moto/awslambda/models.py index 74fe3f151..a3e7f03ef 100644 --- a/moto/awslambda/models.py +++ b/moto/awslambda/models.py @@ -42,11 +42,10 @@ from .utils import make_function_arn, make_function_ver_arn from moto.sqs import sqs_backends from moto.dynamodb2 import dynamodb_backends2 from moto.dynamodbstreams import dynamodbstreams_backends +from moto.iam.models import ACCOUNT_ID logger = logging.getLogger(__name__) -from moto.iam.models import ACCOUNT_ID - try: from tempfile import TemporaryDirectory diff --git a/moto/cloudformation/responses.py b/moto/cloudformation/responses.py index 663183350..64481dd41 100644 --- a/moto/cloudformation/responses.py +++ b/moto/cloudformation/responses.py @@ -1056,7 +1056,7 @@ DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = """ {{ stackset.execution_role }} - arn:aws:iam::"""+ACCOUNT_ID+""":role/{{ stackset.admin_role }} + arn:aws:iam::""" + ACCOUNT_ID + """:role/{{ stackset.admin_role }} {{ stackset.id }} {{ operation.CreationTimestamp }} {{ operation.OperationId }} @@ -1081,7 +1081,7 @@ LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = """ - Function not found: arn:aws:lambda:us-west-2:"""+ACCOUNT_ID+""":function:AWSCloudFormationStackSetAccountGate + Function not found: arn:aws:lambda:us-west-2:""" + ACCOUNT_ID + """:function:AWSCloudFormationStackSetAccountGate SKIPPED {{ region }} diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py index 92654cfcc..32fa2e991 100644 --- a/moto/ec2/responses/instances.py +++ b/moto/ec2/responses/instances.py @@ -249,7 +249,7 @@ class InstanceResponse(BaseResponse): EC2_RUN_INSTANCES = """ 59dbff89-35bd-4eac-99ed-be587EXAMPLE {{ reservation.id }} - """+ACCOUNT_ID+""" + """ + ACCOUNT_ID + """ sg-245f6a01 @@ -331,7 +331,7 @@ EC2_RUN_INSTANCES = """ + """ + ACCOUNT_ID + """ in-use 1b:2b:3c:4d:5e:6f {{ nic.private_ip_address }} @@ -354,7 +354,7 @@ EC2_RUN_INSTANCES = """ + """ + ACCOUNT_ID + """ {% endif %} @@ -364,7 +364,7 @@ EC2_RUN_INSTANCES = """ + """ + ACCOUNT_ID + """ {% endif %} @@ -383,7 +383,7 @@ EC2_DESCRIBE_INSTANCES = """ + """ + ACCOUNT_ID + """ {% for group in reservation.dynamic_group_list %} @@ -476,7 +476,7 @@ EC2_DESCRIBE_INSTANCES = """ + ABCDE""" + ACCOUNT_ID + """3 {% if instance.get_tags() %} {% for tag in instance.get_tags() %} @@ -499,7 +499,7 @@ EC2_DESCRIBE_INSTANCES = """ + """ + ACCOUNT_ID + """ in-use 1b:2b:3c:4d:5e:6f {{ nic.private_ip_address }} @@ -526,7 +526,7 @@ EC2_DESCRIBE_INSTANCES = """ + """ + ACCOUNT_ID + """ {% endif %} @@ -536,7 +536,7 @@ EC2_DESCRIBE_INSTANCES = """ + """ + ACCOUNT_ID + """ {% endif %} diff --git a/moto/ec2/responses/security_groups.py b/moto/ec2/responses/security_groups.py index e90c4d5ff..e74dc7157 100644 --- a/moto/ec2/responses/security_groups.py +++ b/moto/ec2/responses/security_groups.py @@ -177,7 +177,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """ + """ + ACCOUNT_ID + """ {{ group.id }} {{ group.name }} {{ group.description }} @@ -197,7 +197,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """ + """ + ACCOUNT_ID + """ {{ source_group.id }} {{ source_group.name }} @@ -226,7 +226,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """ + """ + ACCOUNT_ID + """ {{ source_group.id }} {{ source_group.name }} diff --git a/moto/ec2/responses/vpc_peering_connections.py b/moto/ec2/responses/vpc_peering_connections.py index be1485488..df33ecf77 100644 --- a/moto/ec2/responses/vpc_peering_connections.py +++ b/moto/ec2/responses/vpc_peering_connections.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.iam.models import ACCOUNT_ID + class VPCPeeringConnections(BaseResponse): def create_vpc_peering_connection(self): peer_region = self._get_param("PeerRegion") @@ -56,7 +57,7 @@ CREATE_VPC_PEERING_CONNECTION_RESPONSE = """ - """+ACCOUNT_ID+""" + """ + ACCOUNT_ID + """ {{ vpc_pcx.peer_vpc.id }} @@ -82,7 +83,7 @@ DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """ {{ vpc_pcx.vpc.cidr_block }} - """+ACCOUNT_ID+""" + """ + ACCOUNT_ID + """ {{ vpc_pcx.peer_vpc.id }} {{ vpc_pcx.peer_vpc.cidr_block }} @@ -120,7 +121,7 @@ ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """ {{ vpc_pcx.vpc.cidr_block }} - """+ACCOUNT_ID+""" + """ + ACCOUNT_ID + """ {{ vpc_pcx.peer_vpc.id }} {{ vpc_pcx.peer_vpc.cidr_block }} diff --git a/moto/iam/models.py b/moto/iam/models.py index 272869e58..dd598c975 100644 --- a/moto/iam/models.py +++ b/moto/iam/models.py @@ -45,7 +45,7 @@ from .utils import ( random_policy_id, ) -ACCOUNT_ID = '123456789012' #make sure this is a str and not an int +ACCOUNT_ID = '123456789012' class MFADevice(object): diff --git a/moto/organizations/utils.py b/moto/organizations/utils.py index b33f219ff..0a685c629 100644 --- a/moto/organizations/utils.py +++ b/moto/organizations/utils.py @@ -2,8 +2,10 @@ from __future__ import unicode_literals import random import string +from moto.iam.models import ACCOUNT_ID -from moto.iam.models import ACCOUNT_ID as MASTER_ACCOUNT_ID + +MASTER_ACCOUNT_ID = ACCOUNT_ID MASTER_ACCOUNT_EMAIL = "master@example.com" DEFAULT_POLICY_ID = "p-FullAWSAccess" ORGANIZATION_ARN_FORMAT = "arn:aws:organizations::{0}:organization/{1}" diff --git a/moto/s3/responses.py b/moto/s3/responses.py index 7251314a3..ff3bec9cf 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -1899,7 +1899,7 @@ S3_ALL_MULTIPARTS = """ {{ upload.key_name }} {{ upload.id }} - arn:aws:iam::"""+ACCOUNT_ID+""":user/user1-11111a31-17b5-4fb7-9df5-b111111f13de + arn:aws:iam::""" + ACCOUNT_ID + """:user/user1-11111a31-17b5-4fb7-9df5-b111111f13de user1-11111a31-17b5-4fb7-9df5-b111111f13de