hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.88k stars 455 forks source link

EcsTaskDefinition: typescript: cpu expects string instead of number #3731

Open staswiner opened 2 months ago

staswiner commented 2 months ago

Expected Behavior

Happens when working in typescript with awsEcs resources, specifically with EcsTaskDefinition. When using capacity provider of 'FARGATE', a task-level 'cpu' field is required. This field is supposed to accept 'number', such as value 10.

Actual Behavior

Happens when working in typescript with awsEcs resources, specifically with EcsTaskDefinition. When using capacity provider of 'FARGATE', a task-level 'cpu' field is required. This field accepts 'string', as provided by 'EcsTaskDefinitionConfig' interface. When providing a string value, such as "10", terraform throws 'Invalid 'cpu' setting for task.'.

Steps to Reproduce

Happens when working in typescript with awsEcs resources, specifically with EcsTaskDefinition. When using capacity provider of 'FARGATE', a task-level 'cpu' field is required. This field is supposed to accept 'number', but the interface 'EcsTaskDefinitionConfig' is expecting a string. When providing a string value, such as "10", terraform throws 'Invalid 'cpu' setting for task.'. I changed to 'number' manually in node_modules, and it worked.

Versions

language: typescript cdktf-cli: 0.20.8 node: v20.17.0 cdktf: 0.20.8 constructs: 10.3.0 jsii: null terraform: 1.9.5 arch: x64 os: linux 5.15.153.1-microsoft-standard-WSL2 providers aws@undefined (LOCAL) terraform provider version: 5.65.0 @cdktf/provider-aws (PREBUILT) terraform provider version: 5.64.0 prebuilt provider version: 19.32.0 cdktf version: ^0.20.0

Providers

┌───────────────┬──────────────────┬─────────┬────────────┬─────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤ │ aws │ 5.65.0 │ │ │ │ │ ├───────────────┼──────────────────┼─────────┼────────────┼─────────────────────┼─────────────────┤ │ aws │ 5.64.0 │ ^0.20.0 │ │ @cdktf/provider-aws │ 19.32.0 │ └───────────────┴──────────────────┴─────────┴────────────┴─────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

in EcsTaskDefinitionConfig interface, change cpu type from 'string' to 'number'

Workarounds

manually change the cdktf library file typescript/node_modules/@cdktf/provider-aws/lib/ecs-task-definition/index.d.ts to accept number instead.

Anything Else?

No response

References

No response

Help Wanted

Community Note