How do I deploy an API gateway proxy properly with configuration_aliases
?
#704
-
A customer asked: We're trying to deploy an API gateway proxy with Gruntwork's module. The code we've created looks like this: terraform {
source = "git::[email protected]:gruntwork-io/terraform-aws-lambda.git//modules/api-gateway-proxy?ref=v0.21.8"
}
# Include the `terragrunt.hcl` located in the root of our Reference Architecture's
# repository because this file contains all the templating required to make our
# Terraform state and AWS provider DRY.
include {
path = find_in_parent_folders()
}
inputs = {
api_name = "test-api"
lambda_functions = {
"" = "ingest-test"
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Gruntwork's API Proxy module has a Here's an example in pure Terraform of how you would pass in such an alias: # ---------------------------------------------------------------------------------------------------------------------
# USE API GATEWAY TO EXPOSE LAMBDA FUNCTION
# ---------------------------------------------------------------------------------------------------------------------
module "api_gateway" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example:
# source = "git::[email protected]:gruntwork-io/terraform-aws-lambda.git//modules/api-gateway-proxy?ref=v1.0.8"
source = "../../../modules/api-gateway-proxy"
providers = {
aws = aws
# NOTE: this is only necessary if you are configuring an EDGE domain (globally optimized API Gateway endpoint using
# CloudFront). For other cases, this can be configured to the base `aws` provider.
aws.us_east_1 = aws.us_east_1
}
api_name = var.name
lambda_functions = {
# Empty string key means proxy everything
"" = module.lambda.function_name
}
... truncated for brevity ... However, when working with Terragrunt code, we use Conversely, for multi-region modules, we generate a bunch of To make this one API proxy module work, for example, you'd need to generate a single generate "providers" {
path = "providers-custom.tf"
if_exists = "overwrite"
contents = <<EOF
provider "aws" {
region = "us-east-1"
alias = "us_east_1"
}
EOF
} |
Beta Was this translation helpful? Give feedback.
Gruntwork's API Proxy module has a
configuration_aliases
config that requires a provider explicitly aliased tous_east_1
to be passed in.Here's an example in pure Terraform of how you would pass in such an alias: