I have a null_resource resource to attach usage plan to api gateway in terraform with this configuration:
This will attach the same usage plan to multiple api gateways
resource "null_resource" "usage_plan_attach" {
count = 4
provisioner "local-exec" {
# Run the script to attach this API to Usage Plan tiers.
command = "apigw-usageplan --api_id ${aws_api_gateway_rest_api.apigw[count.index].id} --stage ${aws_api_gateway_stage.stage[count.index].stage_name} --usage_plans ${jsonencode(var.api_gateway_usage_plans)}"
}
triggers = {
build_number = timestamp()
}
}
This is failing because of the limit on the number of UpdateUsagePlan requests (1 every 20 seconds). Is there any alternative way of doing it?