aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Creating custom resource policy in API GW creates cyclic dependency

Open Pritij opened this issue 6 years ago • 2 comments

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

Pritij avatar Jan 06 '20 11:01 Pritij

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.

jogold avatar Jan 06 '20 11:01 jogold

Opened a feature request for this - https://github.com/aws/aws-cdk/issues/5975

Thanks!

nija-at avatar Jan 27 '20 12:01 nija-at