-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
Reading the pidmode announcement here, the cloudformation description for pidMode here. It explains task is the only option. But currently the FargateTaskDefinition only allows host.
Changing this to host will result in a failed deployment, because host isn't allowed on Fargate (linux) tasks.
Expected Behavior
Consistency between documentation and usable options reflected by synth/deployments in CDK.
Task is the one that is the only one actually supported.
Current Behavior
Error: 'pidMode' can only be set to 'host' for Fargate containers, got: 'task'.
at new FargateTaskDefinition (C:\projects\push-gateway-cdk\node_modules\aws-cdk-lib\aws-ecs\lib\fargate\fargate-task-definition.js:1:2562)
But using the host variant will results in:
Deployment failed: Error: The stack named XXXX failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Invalid request provided: Create TaskDefinition: Tasks using the Fargate launch type do not support pidMode 'host'. The supported value for pidMode is 'task'.
Reproduction Steps
const ftdTask = new ecs.FargateTaskDefinition(stack, `task-that-will-fail-to-synth`, {
cpu: 1024,
memoryLimitMiB: 2048,
pidMode: PidMode.TASK,
});const ftdHost = new ecs.FargateTaskDefinition(stack, `task-that-will-fail-to-deploy`, {
cpu: 1024,
memoryLimitMiB: 2048,
pidMode: PidMode.HOST,
});Possible Solution
Switch the checks from pidMode.HOST to pidMode.TASK.
Additional Information/Context
No response
CDK CLI Version
2.139.0
Framework Version
No response
Node.js Version
v20.12.0
OS
windows
Language
TypeScript
Language Version
No response
Other information
(OS is windows for where I ran CDK, the containers are linux as those are the only one allowing pidMode anyway)