aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
446 stars 198 forks source link

AwsNodeTerminationHandlerAddOn does not work with SQS mode #392

Open vumdao opened 2 years ago

vumdao commented 2 years ago

Describe the bug

Issue: It works well with IMDS mode but got following error when using QUEUE mode

/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/private/uniqueid.ts:42
    throw new Error(`ID components may not include unresolved tokens: ${unresolvedTokens.join(',')}`);
          ^
Error: Resolution error: ID components may not include unresolved tokens: aws-${Token[TOKEN.620]}-nth-lifecycle-hook.
Object creation stack:
  at Execute again with CDK_DEBUG=true to capture stack traces
    at Object.makeUniqueId (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/private/uniqueid.ts:42:11)
    at EksBlueprint.allocateLogicalId (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/stack.ts:975:12)
    at EksBlueprint.getLogicalId (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/stack.ts:473:28)
    at CfnRole.synthesizeLogicalId (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/cfn-element.ts:131:25)
    at Object.produce (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/cfn-element.ts:59:64)
    at LazyString.resolve (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/lazy.ts:352:28)
    at RememberingTokenResolver.resolveToken (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/resolvable.ts:145:24)
    at RememberingTokenResolver.resolveToken (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/private/resolve.ts:282:18)
    at resolve (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/private/resolve.ts:208:51)
    at Object.resolve [as mapToken] (/home/workspace/github/aws-eks-blueprints-cdk/node_modules/aws-cdk-lib/core/lib/private/resolve.ts:115:77)

Subprocess exited with error 1

Expected Behavior

AwsNodeTerminationHandlerAddOn works well with QUEUE mode

Current Behavior

AwsNodeTerminationHandlerAddOn got error when using QUEUE mode

Reproduction Steps

Define AwsNodeTerminationHandlerAddOn with mode Mode.QUEUE

new AwsNodeTerminationHandlerAddOn({
    mode: Mode.QUEUE
  }),

Possible Solution

Ref: https://github.com/aws/aws-cdk/issues/1423

Additional Information/Context

No response

CDK CLI Version

2.25.0

EKS Blueprints Version

1.0.1

Node.js Version

v16.13.0

Environment details (OS name and version, etc.)

Ubuntu

Other information

No response

elamaran11 commented 11 months ago

@vumdao Do you still face this issue.?