class DataProtectionPolicy not working as expected #26669
-
I'd like to apply a data protection policy to a log group and exactly followed the document but it's not working. I believe the reason is somehow in the generated CFN template, all the field names (e.g. I tried Could someone please enlighten me what I did wrong here? Please refer to the following console log for details.
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { DataProtectionStack } from '../lib/data-protection-stack';
const app = new cdk.App();
new DataProtectionStack(app, 'DataProtectionStack', {
});
import * as cdk from "aws-cdk-lib";
import { Construct } from "constructs";
export class DataProtectionStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const dataProtectionPolicy = new cdk.aws_logs.DataProtectionPolicy({
name: "EmailAndLatLngProrectionPolicy",
identifiers: [
cdk.aws_logs.DataIdentifier.EMAILADDRESS,
cdk.aws_logs.DataIdentifier.LATLONG,
],
});
new cdk.aws_logs.LogGroup(this, "TestLogGroup", {
logGroupName: "TestLogGroup",
dataProtectionPolicy,
});
}
}
➜ data-protection git:(main) ✗ cdk synth Resources:
TestLogGroup4EEF7AD4:
Type: AWS::Logs::LogGroup
Properties:
DataProtectionPolicy:
name: EmailAndLatLngProrectionPolicy
description: cdk generated data protection policy
version: "2021-06-01"
statement:
- sid: audit-statement-cdk
dataIdentifier:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :dataprotection::aws:data-identifier/EmailAddress
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :dataprotection::aws:data-identifier/LatLong
operation:
audit:
findingsDestination: {}
- sid: redact-statement-cdk
dataIdentifier:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :dataprotection::aws:data-identifier/EmailAddress
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :dataprotection::aws:data-identifier/LatLong
operation:
deidentify:
maskConfig: {}
RetentionInDays: 731
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: DataProtectionStack/TestLogGroup/Resource
... (omitted) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@github-actions proposed-answer I copied the exact snippet you posted - and I'm reproducing the behavior where the template has these lowercase properties. In fact, the tests in the PR that introduced this feature are like this as well However, when I attempt to deploy the snippet you posted, and then check the Data Protection policy on this log group in the console, it has the Data Protection policy specified in the code and template. What behavior are you experiencing exactly - Is it deploying but without a correct Data Protection policy? |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
#26728