(core): Templating error on custom-resource introduced with version 1.92
See original GitHub issuefor (let index = 0; index < existingVpc.availabilityZones.length; index++) {
let getEndpointIp = new AwsCustomResource(this, idPrefix + 'GetEndpointIp' + index, {
policy: AwsCustomResourcePolicy.fromSdkCalls({resources: AwsCustomResourcePolicy.ANY_RESOURCE}),
onUpdate: {
action: 'describeNetworkInterfaces',
service: 'EC2',
parameters: {NetworkInterfaceIds: vpcendpoint.vpcEndpointNetworkInterfaceIds},
physicalResourceId: PhysicalResourceId.of('DirectoryId'),
outputPath: 'NetworkInterfaces.' + index + '.PrivateIpAddress'
}
})
targetGroup.addTarget(new IpTarget(Token.asString(getEndpointIp.getResponseField('NetworkInterfaces.' + index + '.PrivateIpAddress'))));
}
We are doing this, because we need to put an api gateway behind a load balancer (company policy). If there is a better solution to do this, feedback is welcome.
Reproduction Steps
this is the output with aws-cdk/core 1.91
...
announceGetEndpointIp0D5B4E67A:
Type: Custom::AWS
Properties:
ServiceToken:
Fn::GetAtt:
- AWS12345678
- Arn
Create:
action: describeNetworkInterfaces
service: EC2
parameters:
NetworkInterfaceIds:
Fn::GetAtt:
- announcevpcannouncevpcendpoint55991BB5
- NetworkInterfaceIds
physicalResourceId:
id: DirectoryId
outputPath: NetworkInterfaces.0.PrivateIpAddress
Update:
action: describeNetworkInterfaces
service: EC2
parameters:
NetworkInterfaceIds:
Fn::GetAtt:
- announcevpcannouncevpcendpoint55991BB5
- NetworkInterfaceIds
physicalResourceId:
id: DirectoryId
outputPath: NetworkInterfaces.0.PrivateIpAddress
InstallLatestAwsSdk: true
DependsOn:
- announceGetEndpointIp0CustomResourcePolicyC5EFFE47
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: announce-dev-local/announce-GetEndpointIp0/Resource/Default
...
this is the output with aws-cdk/core 1.92
...
announceGetEndpointIp0D5B4E67A:
Type: Custom::AWS
Properties:
ServiceToken:
Fn::GetAtt:
- AWS12345678
- Arn
Create:
Fn::Join:
- ""
- - '{"action":"describeNetworkInterfaces","service":"EC2","parameters":{"NetworkInterfaceIds":"'
- Fn::GetAtt:
- announcevpcannouncevpcendpoint55991BB5
- NetworkInterfaceIds
- '"},"physicalResourceId":{"id":"DirectoryId"},"outputPath":"NetworkInterfaces.0.PrivateIpAddress"}'
Update:
Fn::Join:
- ""
- - '{"action":"describeNetworkInterfaces","service":"EC2","parameters":{"NetworkInterfaceIds":"'
- Fn::GetAtt:
- announcevpcannouncevpcendpoint55991BB5
- NetworkInterfaceIds
- '"},"physicalResourceId":{"id":"DirectoryId"},"outputPath":"NetworkInterfaces.0.PrivateIpAddress"}'
InstallLatestAwsSdk: true
DependsOn:
- announceGetEndpointIp0CustomResourcePolicyC5EFFE47
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: announce-dev-local/announce-GetEndpointIp0/Resource/Default
...
What did you expect to happen?
After using cdk deploy
we expected the same behavior as in version 1.91 with successful deployment.
What actually happened?
The error only occurs during a cdk deploy
with version 1.92.
26/44 | 8:32:42 AM | CREATE_FAILED | Custom::AWS | announce-GetEndpointIp2/Resource/Default (announceGetEndpointIp20B447BE7) Template error: every Fn::Join object requires two parameters, (1) a string delimiter and (2) a list of strings to be joined or a function that returns a list of strings (such as Fn::GetAZs) to be joined.
new CustomResource (/builds/marceldarvis/toolbox/services/announce-pipeline-modules-service/node_modules/@aws-cdk/core/lib/custom-resource.ts:119:21)
\_ new AwsCustomResource (/builds/marceldarvis/toolbox/services/announce-pipeline-modules-service/node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts:374:27)
Environment
- CDK CLI Version :1.92
- Framework Version:None
- Node.js Version:v14.16.0
- OS :linux
- Language (Version):TypeScript (4.2.3)
Other
We assume that this issue is related to this change:
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (8 by maintainers)
Top Results From Across the Web
AWS::CloudFormation::CustomResource
In a CloudFormation template, you use the AWS::CloudFormation::CustomResource or Custom::String resource type to specify custom resources.
Read more >aws-cdk.core - PyPI
Uses predefined asset locations and roles created by the modern bootstrap template. Access control is done by controlling who can assume the deploy...
Read more >@aws-cdk/custom-resources | Yarn - Package Manager
When CloudFormation needs to create, update or delete a custom resource, it sends a lifecycle event notification to a custom resource provider.
Read more >aws-cdk/custom-resources v1.176.0 - npm.io
The template developer-chosen name (logical ID) of the custom resource in the AWS CloudFormation template. PhysicalResourceId, String, This field will only be ...
Read more >Error while creating custom resource trigger for lambda
You should use cfn-response.send in your custom resource to notify CloudFormation. Find logs in the console: For the logs, you can access ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Doing this will turn
[]
->[""]
though 😦@rix0rrr @eladb thank you for resolving this issue ❤️