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: encrypt sns topic using the ADF CMK KMS Key #429

Merged
merged 3 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ Resources:
Condition:
StringEquals:
aws:PrincipalOrgID: !Ref OrganizationId
- Action:
- kms:Decrypt
- kms:GenerateDataKey
Nr18 marked this conversation as resolved.
Show resolved Hide resolved
Effect: Allow
Principal:
Service:
- sns.amazonaws.com
- events.amazonaws.com
- codecommit.amazonaws.com
Resource: "*"
KMSAlias:
Type: AWS::KMS::Alias
Properties:
Expand Down Expand Up @@ -1137,7 +1147,7 @@ Resources:
"IntervalSeconds": 1,
"MaxAttempts": 10
}
]
]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
aws_lambda as _lambda,
aws_sns as _sns,
aws_iam as _iam,
aws_kms as _kms,
aws_lambda_event_sources as _event_sources,
core
)
Expand All @@ -34,7 +35,8 @@ def __init__(
f'arn:{stack.partition}:lambda:{ADF_DEPLOYMENT_REGION}:'
f'{ADF_DEPLOYMENT_ACCOUNT_ID}:function:SendSlackNotification'
)
_topic = _sns.Topic(self, "PipelineTopic")
kms_alias = _kms.Alias.from_alias_name(self, "KMSAlias", f"alias/codepipeline-{ADF_DEPLOYMENT_ACCOUNT_ID}")
_topic = _sns.Topic(self, "PipelineTopic", master_key=kms_alias)
_statement = _iam.PolicyStatement(
actions=["sns:Publish"],
effect=_iam.Effect.ALLOW,
Expand Down