Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ec2): security group lookup via filters #30625

Merged
merged 23 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
54ccc0d
Adding filters for lookup of security groups
jdukewich Jun 22, 2024
7bdc9a4
Linting fixes and add integration test
jdukewich Jun 22, 2024
db6985d
Integ test updates, still cannot get it to work
jdukewich Jun 29, 2024
cdb9984
Merge remote-tracking branch 'origin/main' into feat/security-group-l…
jdukewich Jun 29, 2024
285af1e
Working integ test snapshot
jdukewich Jun 30, 2024
9cdace1
Fix unit test
jdukewich Jul 1, 2024
3632c45
Merge branch 'main' into feat/security-group-lookup-filters
jdukewich Jul 1, 2024
befdf9c
Fixing doc comments
jdukewich Jul 1, 2024
925e313
Trigger new build
jdukewich Jul 1, 2024
d5e51c0
Merge branch 'main' into feat/security-group-lookup-filters
jdukewich Jul 1, 2024
37038d6
Fix doc typo
jdukewich Jul 2, 2024
2d7039a
Merge branch 'main' into feat/security-group-lookup-filters
jdukewich Jul 2, 2024
29e11e7
Merge branch 'main' into feat/security-group-lookup-filters
jdukewich Jul 3, 2024
1fba558
Merge branch 'main' into feat/security-group-lookup-filters
jdukewich Jul 3, 2024
ce629d8
Merge branch 'main' into feat/security-group-lookup-filters
mergify[bot] Jul 8, 2024
f65e23d
Merge branch 'main' into feat/security-group-lookup-filters
mergify[bot] Jul 10, 2024
7515b82
Merge branch 'main' into feat/security-group-lookup-filters
mergify[bot] Jul 15, 2024
5867668
More coverage on integ test
jdukewich Jul 17, 2024
be1482a
Merge branch 'main' into feat/security-group-lookup-filters
jdukewich Jul 17, 2024
61ff6d1
Merge branch 'main' into feat/security-group-lookup-filters
moelasmar Aug 1, 2024
3d36c55
Merge branch 'main' into feat/security-group-lookup-filters
mergify[bot] Aug 6, 2024
76f7177
Merge branch 'main' into feat/security-group-lookup-filters
xazhao Aug 7, 2024
dd90497
Merge branch 'main' into feat/security-group-lookup-filters
mergify[bot] Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
{
"Resources": {
"MyVpcF9F0CA6F": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"EnableDnsHostnames": true,
"EnableDnsSupport": true,
"InstanceTenancy": "default",
"Tags": [
{
"Key": "Name",
"Value": "my-vpc-name"
}
]
}
},
"MyVpcRestrictDefaultSecurityGroupCustomResourceA4FCCD62": {
"Type": "Custom::VpcRestrictDefaultSG",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E",
"Arn"
]
},
"DefaultSecurityGroupId": {
"Fn::GetAtt": [
"MyVpcF9F0CA6F",
"DefaultSecurityGroup"
]
},
"Account": "12345678"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
},
"ManagedPolicyArns": [
{
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
],
"Policies": [
{
"PolicyName": "Inline",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupIngress",
"ec2:AuthorizeSecurityGroupEgress",
"ec2:RevokeSecurityGroupIngress",
"ec2:RevokeSecurityGroupEgress"
],
"Resource": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":ec2:test-region:12345678:security-group/",
{
"Fn::GetAtt": [
"MyVpcF9F0CA6F",
"DefaultSecurityGroup"
]
}
]
]
}
]
}
]
}
}
]
}
},
"CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": "cdk-hnb659fds-assets-12345678-test-region",
"S3Key": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip"
},
"Timeout": 900,
"MemorySize": 128,
"Handler": "__entrypoint__.handler",
"Role": {
"Fn::GetAtt": [
"CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0",
"Arn"
]
},
"Runtime": "nodejs18.x",
"Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group"
},
"DependsOn": [
"CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0"
]
},
"MySgAFDC270F2": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "StackWithSg/MySgA",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"Tags": [
{
"Key": "myTag",
"Value": "my-value"
}
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MySgB343D3C61": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "StackWithSg/MySgB",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"Tags": [
{
"Key": "myTagKey",
"Value": "true"
}
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MySgC50C8732C": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "my-description",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MySgDA51BA0C2": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "ownerId description",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Loading
Loading