@aws-cdk/aws-cloudfront.experimental: incorrect documentation on role parameter
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Lambda@Edge functions does not return the role object when using `cloudfront.experimental.EdgeFunction` construct.
### Expected Behavior
`EdgeFunction.role` should return an `iam.Role`/`iam.IRole` object.
### Current Behavior
`EdgeFunction.role` returns `undefined`
### Reproduction Steps
### 1. Initiate a typescript project.
> `mkdir cdk-project && cd cdk-project && cdk init --language typescript`
### 2. Add required dependencies to the project.
> `import * as cloudfront from "aws-cdk-lib/aws-cloudfront";`
### 3. Create an `EdgeFunction` resource.
> `const func = new cloudfront.experimental.EdgeFunction(this, "LambdaAtEdge", {...lambdaProps});`
### Possible Solution
### `role` property on the [EdgeFunction](https://github.com/aws/aws-cdk/blob/ab7668197b1d7d7d08654d49df0c5ad9cb61b960/packages/%40aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts#L48) must be initialized.
- The `role` property has been declared, but not initialized on the constructor.
### Additional Information/Context
_No response_
### CDK CLI Version
2.40.0
### Framework Version
_No response_
### Node.js Version
18.3
### OS
Windows 10 Version: 21H2 Build: 19044
### Language
Typescript
### Language Version
3.9.7
### Other information
_No response_
Contributor guide
Research direction
The referenced implementation is packages/@aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts, where the EdgeFunction role property is declared. Start by inspecting that constructor and reproducing the TypeScript example; done means EdgeFunction.role returns an iam.Role/iam.IRole object instead of undefined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100