-
Notifications
You must be signed in to change notification settings - Fork 4k
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
CfnLoadBalancer: CfnInclude broken for conditional tags #30740
Comments
@KyleBS Good afternoon. Thanks for reporting the issue. I'm unsure of your template is correct, but the issue is reproducible using below (modified) CDK code (based on guidance from Conditions and Conditionally tagging resources in CloudFormation): import * as cdk from 'aws-cdk-lib';
import { CfnInclude } from 'aws-cdk-lib/cloudformation-include';
import { Construct } from 'constructs';
import * as fs from 'fs';
const tmp = require('tmp');
export class Issue30740Stack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const template = `{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"IsExtraTag": {
"Type": "String",
"AllowedValues": [
"true",
"false"
],
"Default": "false"
}
},
"Conditions": {
"AddExtraTag": {
"Fn::Equals": [
{
"Ref": "IsExtraTag",
},
"true"
]
}
},
"Resources": {
"MyLoadBalancer": {
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
"Properties": {
"Name": "my-load-balancer",
"Subnets": [
"subnet-0123456789abcdef0"
],
"SecurityGroups": [
"sg-0123456789abcdef0"
],
"Scheme": "internet-facing",
"LoadBalancerAttributes": [
{
"Key": "idle_timeout.timeout_seconds",
"Value": "60"
}
],
"IpAddressType": "ipv4",
"Tags": [
{
"Key": "Name",
"Value": "MyLoadBalancer"
},
{
"Fn::If": [
"AddExtraTag",
{
"Key": "Name2",
"Value": "MyLoadBalancer2"
},
{
"Ref": "AWS::NoValue",
}
]
}
]
}
}
}
}`;
const tmpobj = tmp.fileSync();
fs.writeFileSync(tmpobj.fd, template);
new CfnInclude(this, 'MyStack', {
templateFile: tmpobj.name
});
tmpobj.removeCallback();
}
} Got the below error during
It is more likely related to existing open issue #27594. Thanks, |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
When you attempt to CfnInclude a
AWS::ElasticLoadBalancingV2::LoadBalancer
resource with valid conditional tags CDK errors outExpected Behavior
CfnInclude should succeed
Current Behavior
An error is thrown:
Reproduction Steps
Create a stack and include the following:
You will get the exception
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.87.0
Framework Version
No response
Node.js Version
v18.18.2
OS
AL2
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: