AWS API resource policy issue

Hello Dears,

By using the 1.9.7 version, while making any updates into my code (i.e. any update not related to the api) requires redeploying the API in order to reflect the API resource policy.
Therefore, my main issue lies in the API resource policy not working after any terraform apply, even if the change does not relate to the API. To fix this I must after each apply redeploy the API manually from the AWS console.

HCL code:
resource “aws_api_gateway_rest_api_policy” “api_uat_policy_01” {
rest_api_id = aws_api_gateway_rest_api.rest_api_01.id

policy = file(“${path.module}/scripts/api_resource_policy.json”)
}

1 Like

Dears,
Appreciate your input about this issue.

@Mohamed-Eleraki I am not sure if I fully understand your question. Are you saying that when you change the resource policy, it does not take into effect until you redeploy the API? According to Create and attach an API Gateway resource policy to an API, that is indeed required. If you are also managing deployment in Terraform, perhaps you need to use something like the triggers argument to put a dependency on the resource policy.

As well any changes to resources per Updates to REST APIs that require redeployment would also need redeployment. But you are saying that you are not changing API resources, so this may not be applicable to your scenario.

Thanks for your reply.
Yeah while updating the IaC with no change into the API resources requires a redeploy, I Have avoided this by removing the API resources from the state file :sweat_smile:

and I have another issue here: Creating AWS Auto-scaling group with Access denied error
appreciate your assistance.