aws / aws/aws-cdk

aws-appsync: when specifying logs for eventapi the construct always try to configure the log retention

Open
#34,917 7 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/aws-appsync bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When specifying logs for eventapi the construct always try to configure the log retention even if we don't specify any values for it. I have a customer that has SCP in place where it is not allowed to change the default value of log retention and this behaviour cause issues.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

I would expect that if the props is not specfied, then it would not try to set it

`readonly retention?: RetentionDays;`

### Current Behavior

It always try to set the log retention using `export class LogRetention extends Construct {` but since there are SCPs in place, the construct fails to deploy

### Reproduction Steps

- Have SCP in place that denies modifying the log retention in cloudwatch
- Try to deploy the EventAPI with logs enabled

### Possible Solution

Do not try to set the log retention if undefined instead to set the default value of infinite

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

aws-cdk-lib@2.195.0

### AWS CDK CLI version

2.1010.0

### Node.js Version

v22.14.0

### OS

Mac

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing EventAPI log configuration to the LogRetention construct and the RetentionDays prop mentioned in the issue. Reproduce deployment with logs enabled and retention undefined under an SCP that denies log-retention changes; done means no retention configuration is attempted in that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.