Skip to content

Commit

Permalink
Merge pull request #43 from RSS-Engineering/kevinsecrist/remove-worka…
Browse files Browse the repository at this point in the history
…round

Remove workaround and allow qualified arns to be used
  • Loading branch information
kevin-secrist authored Oct 25, 2023
2 parents 4171bcf + 42e7b16 commit 76f8976
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/api_gateway/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ resource "aws_api_gateway_authorizer" "authorizer" {
name = "api-authorizer-${each.key}"
rest_api_id = aws_api_gateway_rest_api.rest_api.id
type = lookup(var.lambdas[each.key], "authorizer_type", "TOKEN")
# authorizer_uri looks funny because of https://github.com/hashicorp/terraform-provider-aws/issues/26619
authorizer_uri = replace(var.lambdas[each.key]["function_invoke_arn"], "/\\:\\d{1,3}\\/invocations/", "/invocations")
authorizer_uri = var.lambdas[each.key]["function_invoke_arn"]
authorizer_credentials = aws_iam_role.invocation_role.arn
identity_source = lookup(var.lambdas[each.key], "identity_source", "method.request.header.X-Auth-Token")
authorizer_result_ttl_in_seconds = parseint(lookup(var.lambdas[each.key], "authorizer_result_ttl_in_seconds", "900"), 10)
Expand Down Expand Up @@ -219,7 +218,7 @@ resource "aws_api_gateway_integration" "rest_api_route_integration" {
type = each.value["type"]
uri = (
each.value["lambda_key"] != ""
? replace(var.lambdas[each.value["lambda_key"]]["function_invoke_arn"], "/\\:\\d{1,3}\\/invocations/", "/invocations")
? var.lambdas[each.value["lambda_key"]]["function_invoke_arn"]
: each.value["proxy_url"]
)
cache_key_parameters = []
Expand Down
8 changes: 8 additions & 0 deletions modules/api_gateway/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.30.0"
}
}
}

0 comments on commit 76f8976

Please sign in to comment.