forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSecurityGroupId.py
More file actions
25 lines (20 loc) · 751 Bytes
/
SecurityGroupId.py
File metadata and controls
25 lines (20 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from __future__ import annotations
from cfnlint.rules.formats.FormatKeyword import FormatKeyword
class SecurityGroupId(FormatKeyword):
id = "E1150"
shortdesc = "Validate security group format"
description = (
"Security groups have to ref/gettatt to a security "
"group or has the valid pattern"
)
tags = []
source_url = "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/format_keyword.md#AWS::EC2::SecurityGroup.Id"
def __init__(self):
super().__init__(
format="AWS::EC2::SecurityGroup.Id",
pattern=r"^sg-([a-fA-F0-9]{8}|[a-fA-F0-9]{17})$",
)