i have this code:
Mysql:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupName: Mysql
GroupDescription: MySQL security group
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 3306
SourceSecurityGroupName: Mysql
ToPort: 3306
Tags:
- Key: Name
Value: MySQL 3306 Access
VpcId: !ImportValue VPC-ID
this returns this error: The security group 'Mysql' does not exist in default VPC 'vpc-xxx' (Service: AmazonEC2; Status Code: 400; Error Code: InvalidGroup.NotFound; Request ID: xxxxx)
I have had the opportunity to see security groups where if you could self-reference to it, but I can not achieve this rule. Someone who has encountered the same problem?
Use the SecurityGroupIngress or SecurityGroupEgress resources when you need self referencing security groups or security groups that reference each other.
Basically you will create the security group then add a rule to it.