aws-ecs (all): validation should leverage typescript type system
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Audit either/or validations across the CDK and add appropriate types to the interfaces for build time validation rather than runtime validation.
### Use Case
I've seen this in a couple places but most recently with
```
this.taskDefinition.addFirelensLogRouter('FluentBitLogRouter', {
image: ContainerImage.fromRegistry('amazon/aws-for-fluent-bit:latest'),
firelensConfig: {
type: FirelensLogRouterType.FLUENTBIT,
options: {
enableECSLogMetadata: true,
},
},
}
```
Which results in the following error
> ECS Container FluentBitLogRouter must have at least one of 'memoryLimitMiB' or 'memoryReservationMiB' specified
### Proposed Solution
Current:
```
addFirelensLogRouter(id: string, props: FirelensLogRouterDefinitionOptions): FirelensLogRouter;
```
Proposed:
```
addFirelensLogRouter(id: string, props: FirelensLogRouterDefinitionOptions & ({ memoryLimitMiB: number } | { memoryReservationMiB: number })): FirelensLogRouter;
```
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
all
### Environment details (OS name and version, etc.)
OSX
Contributor guide
Research direction
Start at the addFirelensLogRouter entry point and its FirelensLogRouterDefinitionOptions interface, then identify analogous either/or validations across the CDK. Done means the relevant interfaces express the stated alternatives at TypeScript build time and the scope of any breaking change is understood.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100