forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added KMS permissions to lambda handler for e2e tests
- Loading branch information
Showing
3 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import aws_cdk.aws_kms as kms | ||
from aws_cdk import CfnOutput, Duration | ||
from aws_cdk import aws_iam as iam | ||
|
||
from tests.e2e.utils.infrastructure import BaseInfrastructure | ||
|
||
|
||
class DataMaskingStack(BaseInfrastructure): | ||
def create_resources(self): | ||
self.create_lambda_functions(function_props={"timeout": Duration.seconds(10)}) | ||
functions = self.create_lambda_functions(function_props={"timeout": Duration.seconds(10)}) | ||
|
||
key1 = kms.Key(self.stack, "MyKMSKey1", description="My KMS Key1") | ||
CfnOutput(self.stack, "KMSKey1Arn", value=key1.key_arn, description="ARN of the created KMS Key1") | ||
|
||
key2 = kms.Key(self.stack, "MyKMSKey2", description="My KMS Key2") | ||
CfnOutput(self.stack, "KMSKey2Arn", value=key2.key_arn, description="ARN of the created KMS Key2") | ||
|
||
functions["BasicHandler"].add_to_role_policy( | ||
iam.PolicyStatement(effect=iam.Effect.ALLOW, actions=["kms:*"], resources=[key1.key_arn, key2.key_arn]), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters