(escape-hatch): no ability to read properties
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the feature
While I can use the escape hatch to override internal properties in my stack:
```
cfnDefaultPolicy.addPropertyOverride('PolicyDocument.Statement.1.Action',
[
"logs:CreateLogDelivery",
]);
```
There doesn't appear to be a way to read a property value. I would like to see something along the lines of:
```
// I realize this code is fantasy
const action = cfnDefaultPolicy.getProperty('PolicyDocument.Statement.1.Action');
```
While I would think there are many applications of such a capability, it's particularly important for my use case. I am trying to modify/replace a specific statement in an array of statements in a policy document. Using a fixed ordinal number won't work as this number can change because of other places in my code or changes in the CDK implementation. I was able to achieve my goal using .FromJson() and .ToJson(), but it seems to me if addPropertyOverride() is available then the complementary functionality would be expected.
### Use Case
(repeated from above)
I am trying to modify/replace a specific statement in an array of statements in a policy document. Using a fixed ordinal number won't work as this number can change because of other places in my code or changes in the CDK implementation.
### Proposed Solution
_No response_
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.126.0
### Environment details (OS name and version, etc.)
MacOS: 13.6.4 (22G513)
Contributor guide
Research direction
Start by locating the TypeScript implementation of addPropertyOverride and the FromJson()/ToJson() path mentioned in the issue. Define the intended property-reading behavior, including how array paths and changing statement positions should work, then add coverage showing that the chosen behavior can identify and read the requested policy statement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100