{"id":21202441,"url":"https://github.com/infrablocks/terraform-aws-api-gateway-v2-private-integration","last_synced_at":"2025-07-10T06:32:46.093Z","repository":{"id":38289872,"uuid":"495721426","full_name":"infrablocks/terraform-aws-api-gateway-v2-private-integration","owner":"infrablocks","description":"Terraform module for deploying a private integration for a API gateway in AWS using the V2 API","archived":false,"fork":false,"pushed_at":"2024-10-28T21:39:42.000Z","size":432,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-28T22:30:25.815Z","etag":null,"topics":["api-gateway","aws","infrastructure","terraform","terraform-modules"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infrablocks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-24T07:48:23.000Z","updated_at":"2024-10-28T21:39:43.000Z","dependencies_parsed_at":"2023-02-14T11:31:59.026Z","dependency_job_id":"5b9d09ec-9541-4288-9755-84045c9618b1","html_url":"https://github.com/infrablocks/terraform-aws-api-gateway-v2-private-integration","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Fterraform-aws-api-gateway-v2-private-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Fterraform-aws-api-gateway-v2-private-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Fterraform-aws-api-gateway-v2-private-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infrablocks%2Fterraform-aws-api-gateway-v2-private-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infrablocks","download_url":"https://codeload.github.com/infrablocks/terraform-aws-api-gateway-v2-private-integration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225622825,"owners_count":17498170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","aws","infrastructure","terraform","terraform-modules"],"created_at":"2024-11-20T20:15:58.057Z","updated_at":"2024-11-20T20:15:58.904Z","avatar_url":"https://github.com/infrablocks.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Terraform AWS API Gateway V2 Private Integration\n================================================\n\n[![Version](https://img.shields.io/github/v/tag/infrablocks/terraform-aws-api-gateway-v2-private-integration?label=version\u0026sort=semver)](https://github.com/infrablocks/terraform-aws-api-gateway-v2-private-integration/tags)\n[![Build Pipeline](https://img.shields.io/circleci/build/github/infrablocks/terraform-aws-api-gateway-v2-private-integration/main?label=build-pipeline)](https://app.circleci.com/pipelines/github/infrablocks/terraform-aws-api-gateway-v2-private-integration?filter=all)\n[![Maintainer](https://img.shields.io/badge/maintainer-go--atomic.io-red)](https://go-atomic.io)\n\nA Terraform module for creating an API Gateway private integration using the\nV2 API.\n\nThe private integration deployment requires:\n\n* an existing API Gateway API\n* an existing VPC containing the target component with which to integrate\n\nThe private integration deployment consists of:\n\n* an API Gateway integration\n* a set of API Gateway routes\n* an optional VPC link\n\nUsage\n-----\n\nTo use the module, include something like the following in your Terraform\nconfiguration:\n\n```terraform\nmodule \"private_integration\" {\n  source  = \"infrablocks/api-gateway-v2-private-integration/aws\"\n  version = \"1.0.0\"\n  \n  component             = \"private-service\"\n  deployment_identifier = \"production\"\n\n  api_id                    = \"xikuu6ijh7\"\n  integration_uri           = \"arn:aws:elasticloadbalancing:eu-west-2:123456789101:listener/app/private-service-load-balancer/75e05a504b289ab0/d8afe12df4121a4c\"\n  tls_server_name_to_verify = \"https://private-service.example.com\"\n\n  routes = [{\n    route_key: \"GET /\"\n  }]\n\n  vpc_id              = \"vpc-0926873795926a8c2\"\n  vpc_link_subnet_ids = [\n    \"subnet-0fc246023a98b4405\",\n    \"subnet-0f2dee31b2a4841ab\"\n  ]\n}\n```\n\nSee the\n[Terraform registry entry](https://registry.terraform.io/modules/infrablocks/api-gateway-v2-private-integration/aws/latest)\nfor more details.\n\n### Inputs\n\n| Name                                      | Description                                                                                                                                                                   |              Default               |                                      Required                                       |\n|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------:|:-----------------------------------------------------------------------------------:|\n| `component`                               | The component for which this API gateway private integration exists.                                                                                                          |                 -                  |                                         Yes                                         |\n| `deployment_identifier`                   | An identifier for this instantiation.                                                                                                                                         |                 -                  |                                         Yes                                         |\n| `api_id`                                  | The ID of the API gateway API for which to create the integration.                                                                                                            |                 -                  |                                         Yes                                         |\n| `integration_uri`                         | The integration URI to use for the private integration, typically the ARN of an Application Load Balancer listener, Network Load Balancer listener, or AWS Cloud Map service. |                 -                  |                                         Yes                                         |\n| `tls_server_name_to_verify`               | The server name of the target to verify for TLS communication.                                                                                                                |                 -                  |                               If `use_tls` is `true`.                               |\n| `routes`                                  | The routes to configure for this private integration.                                                                                                                         | `[{ route_key: \"ANY /{proxy+}\" }]` |                            If `include_routes` is `true`                            |\n| `request_parameters`                      | The request parameters to configure for this private integration.                                                                                                             |                `[]`                |                                         No                                          |\n| `vpc_id`                                  | The ID of the VPC in which to create the VPC link for this private integration.                                                                                               |                 -                  | If `include_vpc_link` and `include_vpc_link_default_security_group` are both `true` |\n| `vpc_link_id`                             | The ID of a VPC link to use when creating the private integration.                                                                                                            |                 -                  |                          If `include_vpc_link` is `false`                           |\n| `vpc_link_subnet_ids`                     | The subnet IDs in which to create the VPC link for this private integration.                                                                                                  |                `[]`                |                           If `include_vpc_link` is `true`                           |\n| `vpc_link_default_ingress_cidrs`          | The CIDRs allowed access to the VPC via the VPC link when using the default ingress rule.                                                                                     |          `[\"0.0.0.0/0\"]`           |                                         No                                          |\n| `vpc_link_default_egress_cidrs`           | The CIDRs accessible within the VPC via the VPC link when using the default egress rule.                                                                                      |          `[\"0.0.0.0/0\"]`           |                                         No                                          |\n| `tags`                                    | Additional tags to set on created resources.                                                                                                                                  |                `{}`                |                                         No                                          |\n| `include_default_tags`                    | Whether or not to include default tags on created resources.                                                                                                                  |               `true`               |                                         No                                          |\n| `include_vpc_link`                        | Whether or not to create a VPC link for the private integration.                                                                                                              |               `true`               |                                         No                                          |\n| `include_vpc_link_default_security_group` | Whether or not to create a default security group for the VPC link for the private integration.                                                                               |               `true`               |                                         No                                          |\n| `include_vpc_link_default_ingress_rule`   | Whether or not to create the default ingress rule on the security group created for the VPC link.                                                                             |               `true`               |                                         No                                          |\n| `include_vpc_link_default_egress_rule`    | Whether or not to create the default egress rule on the security group created for the VPC link.                                                                              |               `true`               |                                         No                                          |\n| `use_tls`                                 | Whether or not to use TLS when communicating with the target of this integration.                                                                                             |               `true`               |                                         No                                          |\n\n### Outputs\n\n| Name                                 | Description                                                                                                                           |\n|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| `integration_id`                     | The ID of the managed private integration.                                                                                            |\n| `vpc_link_id`                        | Either the ID of the managed VPC link, if included, otherwise the provided VPC link ID.                                               |\n| `vpc_link_default_security_group_id` | The ID of the default security group created for the managed VPC link. This is an empty string if the security group is not included. |\n| `routes`                             | A map of the routes added to the private integration.                                                                                 |\n\n### Compatibility\n\nThis module is compatible with Terraform versions greater than or equal to\nTerraform 1.0 and Terraform AWS provider versions greater than or equal to 4.0.\n\nDevelopment\n-----------\n\n### Machine Requirements\n\nIn order for the build to run correctly, a few tools will need to be installed\non your development machine:\n\n* Ruby (3.1)\n* Bundler\n* git\n* git-crypt\n* gnupg\n* direnv\n* aws-vault\n\n#### Mac OS X Setup\n\nInstalling the required tools is best managed by [homebrew](http://brew.sh).\n\nTo install homebrew:\n\n```shell\nruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"\n```\n\nThen, to install the required tools:\n\n```shell\n# ruby\nbrew install rbenv\nbrew install ruby-build\necho 'eval \"$(rbenv init - bash)\"' \u003e\u003e ~/.bash_profile\necho 'eval \"$(rbenv init - zsh)\"' \u003e\u003e ~/.zshrc\neval \"$(rbenv init -)\"\nrbenv install 3.1.1\nrbenv rehash\nrbenv local 3.1.1\ngem install bundler\n\n# git, git-crypt, gnupg\nbrew install git\nbrew install git-crypt\nbrew install gnupg\n\n# aws-vault\nbrew cask install\n\n# direnv\nbrew install direnv\necho \"$(direnv hook bash)\" \u003e\u003e ~/.bash_profile\necho \"$(direnv hook zsh)\" \u003e\u003e ~/.zshrc\neval \"$(direnv hook $SHELL)\"\n\ndirenv allow \u003crepository-directory\u003e\n```\n\n### Running the build\n\nRunning the build requires an AWS account and AWS credentials. You are free to\nconfigure credentials however you like as long as an access key ID and secret\naccess key are available. These instructions utilise\n[aws-vault](https://github.com/99designs/aws-vault) which makes credential\nmanagement easy and secure.\n\nTo run the full build, including unit and integration tests, execute:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go\n```\n\nTo run the unit tests, execute:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go test:unit\n```\n\nTo run the integration tests, execute:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go test:integration\n```\n\nTo provision the module prerequisites:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go deployment:prerequisites:provision[\u003cdeployment_identifier\u003e]\n```\n\nTo provision the module contents:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go deployment:root:provision[\u003cdeployment_identifier\u003e]\n```\n\nTo destroy the module contents:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go deployment:root:destroy[\u003cdeployment_identifier\u003e]\n```\n\nTo destroy the module prerequisites:\n\n```shell\naws-vault exec \u003cprofile\u003e -- ./go deployment:prerequisites:destroy[\u003cdeployment_identifier\u003e]\n```\n\nConfiguration parameters can be overridden via environment variables. For\nexample, to run the unit tests with a seed of `\"testing\"`, execute:\n\n```shell\nSEED=testing aws-vault exec \u003cprofile\u003e -- ./go test:unit\n```\n\nWhen a seed is provided via an environment variable, infrastructure will not be\ndestroyed at the end of test execution. This can be useful during development\nto avoid lengthy provision and destroy cycles.\n\nTo subsequently destroy unit test infrastructure for a given seed:\n\n```shell\nFORCE_DESTROY=yes SEED=testing aws-vault exec \u003cprofile\u003e -- ./go test:unit\n```\n\n### Common Tasks\n\n#### Generating an SSH key pair\n\nTo generate an SSH key pair:\n\n```shell\nssh-keygen -m PEM -t rsa -b 4096 -C integration-test@example.com -N '' -f config/secrets/keys/bastion/ssh\n```\n\n#### Generating a self-signed certificate\n\nTo generate a self signed certificate:\n\n```shell\nopenssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365\n```\n\nTo decrypt the resulting key:\n\n```shell\nopenssl rsa -in key.pem -out ssl.key\n```\n\n#### Managing CircleCI keys\n\nTo encrypt a GPG key for use by CircleCI:\n\n```shell\nopenssl aes-256-cbc \\\n  -e \\\n  -md sha1 \\\n  -in ./config/secrets/ci/gpg.private \\\n  -out ./.circleci/gpg.private.enc \\\n  -k \"\u003cpassphrase\u003e\"\n```\n\nTo check decryption is working correctly:\n\n```shell\nopenssl aes-256-cbc \\\n  -d \\\n  -md sha1 \\\n  -in ./.circleci/gpg.private.enc \\\n  -k \"\u003cpassphrase\u003e\"\n```\n\nContributing\n------------\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/infrablocks/terraform-aws-api-gateway-v2-private-integration.\nThis project is intended to be a safe, welcoming space for collaboration, and\ncontributors are expected to adhere to\nthe [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\nLicense\n-------\n\nThe library is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfrablocks%2Fterraform-aws-api-gateway-v2-private-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfrablocks%2Fterraform-aws-api-gateway-v2-private-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfrablocks%2Fterraform-aws-api-gateway-v2-private-integration/lists"}