Skip to content

(ecs.FargateTaskDefinition): runtime check for EphemeralStorageGiB makes it incompatible with CfnParameter tokens #16648

@nacitar

Description

@nacitar

throw new Error('Ephemeral storage size must be between 21GiB and 200GiB');

The check here validates the values, however when using a CfnParameter's ValueAsNumber, you get a value such as:
-1.8881545897087957E+289

This value is, of course, a token. However, because of this local parameter validation, and it not exempting these token values from the check, you simply cannot use a CfnParameter for this field. If the check was done on the AWS side it would be fine, as it would know the real value by that point.

Reproduction Steps

Make a fargate task definition and try to pass in a CfnParameter's ValueAsNumber as the EphemeralStorageGiB, it will throw no matter what default/value it has because it validates the token as if it's the real value.

What did you expect to happen?

No exception, but rather a failure at deploy time IFF the value is out of the valid range.

What actually happened?

An exception was thrown preventing me from even generating the template in the first place, despite no real value being present to even fail the validation.

Environment

  • CDK CLI Version : 1.116.0 (build d04661d)
  • Framework Version: .NET Core 3.1
  • Node.js Version: v14.17.6
  • OS : Windows 10
  • Language (Version): C#

This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecsRelated to Amazon Elastic ContainerbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions