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
148 stars 200 forks source link

Add support for authorizer_credentials in authorizers #70

Closed dfradejas closed 2 years ago

dfradejas commented 2 years ago

Hi,

We want to execute a Lambda function as authenticator for Api Gateway and we need permissions to execute it. For that, original resource has the parameter authorizer_credentials https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_authorizer#authorizer_credentials

We are checking the code and see that this parameter is not supported yet. Would you add this parameter for authorizers?

Regards, Daniel

dfradejas commented 2 years ago

I made a fork and just adding this works.

diff --git a/main.tf b/main.tf
index 561beca..e677fa7 100644
--- a/main.tf
+++ b/main.tf
@@ -192,6 +192,7 @@ resource "aws_apigatewayv2_authorizer" "this" {
   authorizer_uri                    = try(each.value.authorizer_uri, null)
   authorizer_payload_format_version = try(each.value.authorizer_payload_format_version, null)
   authorizer_result_ttl_in_seconds  = try(each.value.authorizer_result_ttl_in_seconds, null)
+  authorizer_credentials_arn        = try(each.value.authorizer_credentials_arn, null)

   dynamic "jwt_configuration" {
     for_each = length(try(each.value.audience, [each.value.issuer], [])) > 0 ? [true] : []

Regards, Daniel

antonbabenko commented 2 years ago

This issue has been resolved in version 1.8.0 :tada:

antonbabenko commented 2 years ago

Fixed in #71. The link to the documentation was for API Gateway v1 but this module is managing API Gateway v2.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.