Creating custom resource policy in API GW creates cyclic dependency
Creating custom resource policy in API GW creates cyclic dependency
While creating API GW with CDK, we want to specify a custom resource policy for an API. But we can not specify the Resource component in policy document as, resource is ARN of API, which results in cyclic dependency. We didnt find any way to attach resource policy after creating the API. Hence, for now we are using '*' in resources.
Please let us know if there is a way to attach resource policy after creating API otherwise please add the required feature to do so.
Environment
- CDK CLI Version: 1.19
- OS: Windows 10
- Language: Python
See this https://stackoverflow.com/questions/59324529/how-to-create-api-gateway-resource-policy-that-references-itself-in-the-python-c?noredirect=1#comment104851614_59324529 and this https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-policy
Setting resources automatically should be implemented in the CDK.
Opened a feature request for this - https://github.com/aws/aws-cdk/issues/5975
Thanks!