Skip to content

Commit 299e448

Browse files
committed
restore custom_id validation
1 parent 997b633 commit 299e448

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

localstack-core/localstack/services/ec2/patches.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from moto.utilities.id_generator import TAG_KEY_CUSTOM_ID, Tags
66

77
from localstack.services.ec2.exceptions import (
8+
InvalidSecurityGroupDuplicateCustomIdError,
89
InvalidSubnetDuplicateCustomIdError,
910
InvalidVpcDuplicateCustomIdError,
1011
)
@@ -120,6 +121,9 @@ def ec2_create_security_group(
120121
tags: dict[str, str] = tags or {}
121122
custom_id = tags.get(TAG_KEY_CUSTOM_ID)
122123

124+
if self.get_security_group_from_id(custom_id):
125+
raise InvalidSecurityGroupDuplicateCustomIdError(custom_id)
126+
123127
# Generate security group with moto library
124128
result: ec2_models.security_groups.SecurityGroup = fn(
125129
self, *args, tags=tags, force=force, **kwargs

0 commit comments

Comments
 (0)