Skip to content

Terraform AWS ARC API Gateway Module Usage Guide

Introduction

Purpose of the Document

This document provides guidelines and instructions for users looking to create api-gateway using the module.

Module Overview

The API Gateway Terraform module provides an easy way to create and manage REST APIs on AWS. It supports defining resources, methods (GET, POST, etc.), and integrations with Lambda functions or other AWS services. The module also supports adding usage plans and API keys, enabling you to manage access, throttle requests, and monitor API usage. This helps ensure secure, scalable, and well-governed API deployments.

Prerequisites

Before using this module, ensure you have the following:

  • AWS credentials configured.
  • Terraform installed.
  • A working knowledge of AWS VPC, API Gateway and Terraform concepts.

Getting Started

Module Source

To use the module in your Terraform configuration, include the following source block:

module "api_gateway" {
  source                 = "sourcefuse/arc-api-gateway/aws"
  version                = "0.0.1"

  name          = "arc-app"
  stage_name    = "dev"
  endpoint_type = "REGIONAL"
  open_api_json = file("${path.module}/openapi.json")

  enable_cloudwatch_logs = true

  # Custom domain (optional)
  api_gateway_domain = {
    create              = true
    domain              = "arc-api.${local.domain}"
    certificate_arn     = data.aws_acm_certificate.this.arn
    route53_root_domain = local.domain
  }
}

Refer to the Terraform Registry for the latest version.

Integration with Existing Terraform Configurations

Refer to the Terraform Registry for the latest version.

Integration with Existing Terraform Configurations

Integrate the module with your existing Terraform mono repo configuration, follow the steps below:

  • Create a new folder in terraform/api-gateway named .
  • Create the required files, see the examples to base off of.
  • Configure with your backend:
    • Create the environment backend configuration file: config..hcl
    • region: Where the backend resides
    • key: /terraform.tfstate
    • bucket: Bucket name where the terraform state will reside
    • dynamodb_table: Lock table so there are not duplicate tfplans in the mix
    • encrypt: Encrypt all traffic to and from the backend

Required AWS Permissions

Ensure that the AWS credentials used to execute Terraform have the necessary permissions to create, list and modify:

  • All api-gateway services
  • VPC and networking configuration

Module Configuration

Input Variables

For a list of input variables, see the README Inputs section.

Output Values

For a list of outputs, see the README Outputs section.

Module Usage

Basic Usage

For basic usage, see the examples folder.

This example will create:

  • api-gateway Studio Domain: Complete

Tips and Recommendations

  • The module focuses on provisioning api-gateway. The convention-based approach enables downstream services to easily attach to the api-gateway. Adjust the configuration parameters as needed for your specific use case.

Troubleshooting

Reporting Issues

If you encounter a bug or issue, please report it on the GitHub repository.

Security Considerations

AWS VPC

Understand the security considerations related to api-gateway on AWS when using this module.

Best Practices for AWS api-gateway

Follow best practices to ensure secure api-gateway configurations:

Contributing and Community Support

Contributing Guidelines

Contribute to the module by following the guidelines outlined in the CONTRIBUTING.md file.

Reporting Bugs and Issues

If you find a bug or issue, report it on the GitHub repository.

License

License Information

This module is licensed under the Apache 2.0 license. Refer to the LICENSE file for more details.

Open Source Contribution

Contribute to open source by using and enhancing this module. Your contributions are welcome!