aws-s3-bucket-deployment: lazy values do not work with Source
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
When using a Lazy value for any of the Source inputs, they are getting resolved immediately due to bind happening in construction. i.e:
```typescript
Source.jsonData(
DEFAULT_RUNTIME_CONFIG_FILENAME,
Lazy.any({provide => someValue})
)
```
We should be able to support synthesis time values here also by delaying the source binding until synthesis time.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
Lazy values should work when passing them in as Sources to the `BucketDeployment`
### Current Behavior
They are evaluated immediately.
### Reproduction Steps
```typescript
Source.jsonData(
'myfile.json,
Lazy.any(produce: () => {console.log('getting called before synth'); return {deferred: 'value'}})
)
```
### Possible Solution
We should be able to support synthesis time values here also by delaying the source binding until synthesis time.
### Additional Information/Context
_No response_
### CDK CLI Version
latest
### Framework Version
_No response_
### Node.js Version
18
### OS
osx
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the BucketDeployment Source.jsonData path shown in the reproduction and trace where Source inputs are bound during construction versus synthesis. Run the provided Lazy.any example and confirm that the value is not evaluated before synthesis and is available when synthesis occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100