terraform-aws-modules / terraform-aws-apigateway-v2

Terraform module to create AWS API Gateway v2 (HTTP/WebSocket) 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/apigateway-v2/aws
Apache License 2.0
144 stars 188 forks source link

hardcoded $default stage name causes error when running WEBSOCKET protocol #7

Closed sjf3 closed 4 weeks ago

sjf3 commented 3 years ago

https://github.com/terraform-aws-modules/terraform-aws-apigateway-v2/blob/master/main.tf#L55 changing $default to default when protocol != "HTTP" resolved my issue trying to connect. Was getting 429 on the first connection request to brand new websocket api gateways. Wondering if I triggered a loop in the api gateway logic since $default is the default route. name = var.protocol_type == "HTTP" ? "$default" : "default" should fix this issue and be backwards compatible

atrinchillo-mwb commented 3 years ago

I think something strange happens for $default maybe related to terraform provider or the aws api Indeed if you try to enable ERROR log for $default you do not find any loggroup on cloudwatch If you try to create a stage with different name like "test" it will correctly generate loggroups and logs

Also on $default stage I am unable to disable "access log" after enabiling it.

Is it possible to try to reproduce this problem on websocket? Alternatively is it possible to create a default stage with another name than $default? Or we need to create it by ourself with a new resource? Is it possible ideally to have a variable to create a default stage with a name selected by the user?

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

rafaljanicki commented 1 year ago

@atrinchillo-mwb I can confirm that, reason being is that CW log groups can't have $ in the name hence the log group wasn't created. I had to create a separate stage outside of the module to be able to see logs

antonbabenko commented 4 weeks ago

This issue has been resolved in version 5.0.0 :tada: