Open baartch opened 1 year ago
The api.arn
is actually from the cloudformation returned values:
Arn The Amazon Resource Name (ARN) of the API key, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid.
If the createApiKey
does expected versioned arn, maybe we should return a versioned arn attribute from the constructor but I am not sure if this is a good idea.
@pahud
It may be more convenient for users. So, could we add new propety .versionedArn
to GraphqlApi
class?
if it seems ok, I'll take it.
Describe the bug
I want to grant a Lambda function to rotate the API_KEY of the AppSync API. If I provide the ARN of the AppSync API to the PolicyStatement of the Lambda, I get the following error.
Please note the
v1
beforeapis
Oh, and just for completeness. There is the same behaviour when I try to grant via the API object:
Expected Behavior
I expect the ARN coming from the API constructor being the same as the one needed to grant permission to.
Current Behavior
The ARN coming from the API constructor is without
v1
, and the one needed to grant a Lambda permission to the API has to contain av1
.Coming from API Constructor:
Needed to grant a Lambda:
Reproduction Steps
To reproduce, see my bug description.
Possible Solution
My workaround is to concat the strings manually. I don't know if there is any better solution.
Additional Information/Context
No response
CDK CLI Version
2.91.0 (build eea12ea)
Framework Version
No response
Node.js Version
Node.js v18.17.0
OS
Ubuntu 22.04 - Linux version 5.15.90.1-microsoft-standard-WSL2
Language
Typescript
Language Version
typescript@5.0.4
Other information
No response