Closed mcuervoe closed 2 years ago
Here's where that error is being thrown in the code: https://github.com/aws/aws-cdk/blob/7966f8d48c4bff26beb22856d289f9d0c7e7081d/packages/%40aws-cdk/core/lib/tag-manager.ts#L54
I suspect that the CfnInclude class is getting confused by ASG having a tags property.
Thanks for opening the issue @mcuervoe. Confirming I was able to reproduce it. I'm investigating what is happening.
Interestingly, a minimum template like this:
{
"Resources": {
"TxAutoScalingGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"Tags": [
{
"Key": "datomic:subscriber",
"Value": "SystemName",
"PropagateAtLaunch": true
}
],
"MinSize": "1",
"MaxSize": "3"
}
}
}
}
does not reproduce the problem, so the issue must be more subtle.
Ah. This does though:
{
"Conditions": {
"ValcacheServerEnabled": true
},
"Resources": {
"TxAutoScalingGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"Tags": [
{
"Fn::If": [
"ValcacheServerEnabled",
{
"Key": "datomic:cache-group",
"Value": "SystemName",
"PropagateAtLaunch": true
},
{
"Ref": "AWS::NoValue"
}
]
}
],
"MinSize": "1",
"MaxSize": "3"
}
}
}
}
Let me see what the problem is.
Interesting... you actually cannot represent this template in the CDK L1!
This doesn't compile:
const tagIfTrue: autoscaling.CfnAutoScalingGroup.TagPropertyProperty = {
key: 'datomic:cache-group',
value: 'SystemName',
propagateAtLaunch: true,
};
new autoscaling.CfnAutoScalingGroup(this, 'CfnAutoScalingGroup', {
minSize: '1',
maxSize: '3',
tags: [
cdk.Fn.conditionIf('ValcacheServerEnabled', tagIfTrue, cdk.Aws.NO_VALUE),
],
});
This is probably the reason why it fails including.
@mcuervoe can you edit the template before including it to remove the Fn::If
there? Either remove it, if ValcacheServerEnabled
is false, or leave just { "Key": "datomic:cache-group", "Value": { "Ref": "SystemName" }, "PropagateAtLaunch": true }
if ValcacheServerEnabled
is true? That should unblock you.
Looks like this might be a more fundamental problem with the CDK L1 layer than just a simple change in the CfnInclude
class, unfortunately, so it might take us longer to fix.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
What is the problem?
Including a valid cloudformation template provided by cognitect/datomic using @aws-cdk/cloudformation-include fails
Reproduction Steps
The following code fails
The error that I get is
The template can be found here https://s3.amazonaws.com/datomic-cloud-1/cft/936-9118/datomic-compute-936-9118.json or in the document attached
datomic-compute-936-9118.zip
What did you expect to happen?
The template should be included without errors
What actually happened?
The complete error message trace after executing
cdk ls
CDK CLI Version
1.126.0 (build f004e1a)
Framework Version
1,126.0
Node.js Version
v12.22.6
OS
Linux
Language
Typescript, Python, Java
Language Version
Java (11), python (3.8.6), Typescript (3.9.7)
Other information
Although I have not provided the code, the same error message is generated in java and python equivalent versions