Open matthias-pichler opened 1 year ago
I can see that the wrong casing is getting generated. This has been the case ever since the feature was first introduced in 2.31.0
- except for versions 2.55.0
and 2.56.0
due to the breaking changes in the spec in 2.55.0
that we patched here in 2.56.1
https://github.com/aws/aws-cdk/blob/8189fbef2913ac13922146403480b7a8a4a1152d/packages/%40aws-cdk/cfnspec/spec-source/specification/000_cfn/500_Revert_To_Json_Types_patch.json#L92-L107
That said, I'm not running into any errors both on 2.31.0
and 2.78.0
, my flow log is successfully deploying with the destination settings specified. I wonder if this has to do with you trying to specify a transit gateway instead of using one of our factory methods given that we don't support transit gateway here yet (it doesn't look like we have an open feature request for that either)
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
So when I use the factory method the wrong options (lowercased) get synthesized
"FlowLog3CB084E9": {
"Type": "AWS::EC2::FlowLog",
"Properties": {
"ResourceId": {
"Fn::GetAtt": [
"TransitGateway",
"Id"
]
},
"ResourceType": "TransitGateway",
"DestinationOptions": {
"fileFormat": "plain-text",
"perHourPartition": false,
"hiveCompatiblePartitions": false
},
"LogDestination": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::aws-tgw-flow-logs-**********-eu-west-1"
]
]
},
"LogDestinationType": "s3"
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain",
"Metadata": {
"aws:cdk:path": "transit-gateway-dev/FlowLog/FlowLog"
}
}
So either way the only way the CDK currently generates these options is in lowercase, which is also how I understand the code because here
destinationOptions
is of type DestinationOptions
which only has the lowercase keys:
@peterwoodworth What exactly did you test to generate the correct options? Because the default is to omit destinationOptions
.
I'm only generating the correct casing on the two specific versions I mentioned (2.55.0, 2.56.0). What I meant was that it successfully deploys for me anyway, for some reason, even with the wrong casing.
In the meantime while we decide how to best address this in our construct library, you can use escape hatches to override the output CDK creates.
@matthias-pichler-warrify thanks for reporting this. I was also able to replicate this issue. To implement @peterwoodworth's suggestion on escape hatches you can do the following as a temporary fix until we solve this issue:
const cfnFlowLog = flowLog.node.defaultChild as CfnFlowLog;
// Delete incorrect lower-cased properties
cfnFlowLog.addPropertyDeletionOverride('DestinationOptions.fileFormat');
cfnFlowLog.addPropertyDeletionOverride('DestinationOptions.hiveCompatiblePartitions');
cfnFlowLog.addPropertyDeletionOverride('DestinationOptions.perHourPartition');
// Add correct properties
cfnFlowLog.addPropertyOverride('DestinationOptions.FileFormat', FlowLogFileFormat.PLAIN_TEXT);
cfnFlowLog.addPropertyOverride('DestinationOptions.HiveCompatiblePartitions', false);
cfnFlowLog.addPropertyOverride('DestinationOptions.PerHourPartition', false);
Describe the bug
When I create a FlowLog like so:
the destination options are not set correctly
Expected Behavior
When setting the options here they should be first transformed to pascal case
Current Behavior
During deploy time I get the following warnings:
Reproduction Steps
Deploy the above resource
Possible Solution
Additional Information/Context
No response
CDK CLI Version
2.77.0
Framework Version
2.77.0
Node.js Version
18
OS
MacOS
Language
Typescript
Language Version
TypeScript 5.0.4
Other information
No response