-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf4f04e
commit f84e838
Showing
7 changed files
with
105 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,45 +51,15 @@ Look at our [Terraform example](latest/examples/terraform/) where you can get a | |
* Both rest or http types can be enabled at the same time during apply. | ||
<br> | ||
|
||
### Terragrunt Complete Example | ||
``` | ||
locals { | ||
external_deps = read_terragrunt_config(find_in_parent_folders("external-deps.hcl")) | ||
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) | ||
product_vars = read_terragrunt_config(find_in_parent_folders("product.hcl")) | ||
env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) | ||
product = local.product_vars.locals.product_name | ||
prefix = local.product_vars.locals.prefix | ||
account = local.account_vars.locals.account_id | ||
env = local.env_vars.locals.env | ||
tags = merge( | ||
local.env_vars.locals.tags, | ||
local.additional_tags | ||
) | ||
additional_tags = { | ||
} | ||
} | ||
include { | ||
path = find_in_parent_folders() | ||
} | ||
dependency "internal_nlb_1" { | ||
config_path = "../nlb/internal/1" | ||
} | ||
dependency "internal_nlb_2" { | ||
config_path = "../nlb/internal/2" | ||
} | ||
dependency "vpc" { | ||
config_path = "../vpc" | ||
} | ||
## Special Notes | ||
* (REST VPC Link) | ||
* When renaming a REST VPC Link, the attached NLB resource may not be detached from the VPC Link and the module will return an error. In this case, you will need to delete the VPC Link manually. | ||
<br> | ||
|
||
### Basic Terragrunt Example | ||
``` | ||
terraform { | ||
source = "git::[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.0" | ||
source = "git::[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
} | ||
|
@@ -102,11 +72,6 @@ inputs = { | |
name = "rest-vpc-link1-dev" | ||
description = "VPC Link for development REST APIs." | ||
target_arns = [dependency.internal_nlb_1.outputs.lb_arn] | ||
}, | ||
{ | ||
name = "rest-vpc-link2-qa" | ||
description = "VPC Link for production REST APIs." | ||
target_arns = [dependency.internal_nlb_2.outputs.lb_arn] | ||
} | ||
] | ||
|
@@ -115,22 +80,17 @@ inputs = { | |
name = "http-vpc-link1-dev" | ||
security_group_ids = [dependency.vpc.outputs.default_security_group_id] | ||
subnet_ids = dependency.vpc.outputs.private_subnets | ||
}, | ||
{ | ||
name = "http-vpc-link1-qa" | ||
security_group_ids = [dependency.vpc.outputs.default_security_group_id] | ||
subnet_ids = dependency.vpc.outputs.private_subnets | ||
}, | ||
} | ||
] | ||
tags = local.tags | ||
} | ||
``` | ||
|
||
## Complete Terraform Example | ||
## Basic Terraform Example | ||
``` | ||
module "vpc-links" { | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.0" | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
create_rest_vpc_links = true | ||
create_http_vpc_links = true | ||
|
@@ -139,11 +99,6 @@ module "vpc-links" { | |
name = "rest-vpc-link1-dev" | ||
description = "VPC Link for development REST APIs." | ||
target_arns = ["arn:aws:elasticloadbalancing:us-east-1:1111111111111:loadbalancer/net/test1/abcd12345"] | ||
}, | ||
{ | ||
name = "rest-vpc-link2-qa" | ||
description = "VPC Link for production REST APIs." | ||
target_arns = ["arn:aws:elasticloadbalancing:us-east-1:1111111111111:loadbalancer/net/test2/abcd12345"] | ||
} | ||
] | ||
|
@@ -152,12 +107,7 @@ module "vpc-links" { | |
name = "http-vpc-link1-dev" | ||
security_group_ids = ["sg-123456789abcdefg"] | ||
subnet_ids = ["subnet-132456789abcdefg"] | ||
}, | ||
{ | ||
name = "http-vpc-link1-qa" | ||
security_group_ids = ["sg-123456789abcdefg"] | ||
subnet_ids = ["subnet-132456789abcdefg"] | ||
}, | ||
} | ||
] | ||
tags = { | ||
Environment = "dev" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,51 @@ | ||
## Basic Terraform Example (REST) | ||
``` | ||
module "vpc-links" { | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
create_rest_vpc_links = true | ||
create_http_vpc_links = false | ||
rest_vpc_links = [ | ||
{ | ||
name = "rest-vpc-link1-dev" | ||
description = "VPC Link for development REST APIs." | ||
target_arns = ["arn:aws:elasticloadbalancing:us-east-1:1111111111111:loadbalancer/net/test1/abcd12345"] | ||
} | ||
] | ||
tags = { | ||
Environment = "dev" | ||
Owner = "DevOps" | ||
CreatedByTerraform = true | ||
} | ||
} | ||
``` | ||
## Basic Terraform Example (HTTP) | ||
``` | ||
module "vpc-links" { | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
create_rest_vpc_links = false | ||
create_http_vpc_links = true | ||
http_vpc_links = [ | ||
{ | ||
name = "http-vpc-link1-dev" | ||
security_group_ids = ["sg-123456789abcdefg"] | ||
subnet_ids = ["subnet-132456789abcdefg"] | ||
} | ||
] | ||
tags = { | ||
Environment = "dev" | ||
Owner = "DevOps" | ||
CreatedByTerraform = true | ||
} | ||
} | ||
``` | ||
## Complete Terraform Example | ||
``` | ||
module "vpc-links" { | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.0" | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
create_rest_vpc_links = true | ||
create_http_vpc_links = true | ||
|
@@ -37,61 +81,3 @@ module "vpc-links" { | |
} | ||
} | ||
``` | ||
<br> | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.67.0 | | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 | ||
| <a name="requirement_terragrunt"></a> [terragrunt](#requirement\_terragrunt) | >= 0.28.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.30.0 | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [apigateway_vpc_link.rsm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_vpc_link) | resource | | ||
| [apigatewayv2_vpc_link.rsm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_vpc_link) | resource | | ||
|
||
## Available Inputs | ||
|
||
| Name | Resource | Variable | Data Type | Default | Required? | ||
| ----------------------------- | ----------------------- | -------------------- | --------- | ------- | -------- | | ||
| REST VPC Link Name | `apigateway_vpc_link` | `name` | `string` | `null` | Yes | | ||
| REST VPC Link Description | `apigateway_vpc_link` | `description` | `string` | `null` | No | | ||
| REST NLB Target Arns | `apigateway_vpc_link` | `target_arns` | `string` | `null` | Yes | | ||
| HTTP VPC Link Name | `apigatewayv2_vpc_link` | `name` | `string` | `null` | Yes | | ||
| HTTP VPC Link Security Groups | `apigatewayv2_vpc_link` | `security_group_ids` | `string` | `null` | Yes | | ||
| HTTP VPC Link Subnet Ids | `apigatewayv2_vpc_link` | `subnet_ids` | `string` | `null` | Yes | | ||
|
||
## Predetermined Inputs | ||
|
||
| Name | Resource | Property | Data Type | Default | Required? | ||
| -------------------- | ---------------------- | ---------- | --------- | ------- | -------- | | ||
| | | | | | | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------------------------------------------|--------------------------------------- | | ||
| apigateway_vpc_link.id | Id of the REST VPC Link. | | ||
| apigateway_vpc_link.name | Name of the REST VPC Link. | | ||
| apigateway_vpc_link.description | Description of the REST VPC Link. | | ||
| apigateway_vpc_link.target_arns | NLB Arns of the REST VPC link. | | ||
| apigatewayv2_vpc_link.name | Name of the HTTP VPC Link. | | ||
| apigatewayv2_vpc_link.security_group_ids | Security Groups for the HTTP VPC link. | | ||
| apigatewayv2_vpc_link.subnet_ids | Subnet Ids for the HTTP VPC link. | | ||
|
||
## Supporting Articles & Documentation | ||
- AWS Hyperplane and AWS PrivateLink | ||
- https://aws.amazon.com/blogs/compute/understanding-vpc-links-in-amazon-api-gateway-private-integrations/ | ||
- Building private cross-account APIs using Amazon API Gateway and AWS PrivateLink | ||
- https://aws.amazon.com/blogs/compute/building-private-cross-account-apis-using-amazon-api-gateway-and-aws-privatelink/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module "vpc-links" { | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.0" | ||
source = "[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
create_rest_vpc_links = true | ||
create_http_vpc_links = true | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,49 @@ | ||
### Terragrunt Complete Example | ||
### Terragrunt Basic Example (REST) | ||
``` | ||
locals { | ||
external_deps = read_terragrunt_config(find_in_parent_folders("external-deps.hcl")) | ||
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) | ||
product_vars = read_terragrunt_config(find_in_parent_folders("product.hcl")) | ||
env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) | ||
product = local.product_vars.locals.product_name | ||
prefix = local.product_vars.locals.prefix | ||
account = local.account_vars.locals.account_id | ||
env = local.env_vars.locals.env | ||
terraform { | ||
source = "git::[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
} | ||
tags = merge( | ||
local.env_vars.locals.tags, | ||
local.additional_tags | ||
) | ||
inputs = { | ||
create_rest_vpc_links = true | ||
create_http_vpc_links = false | ||
additional_tags = { | ||
} | ||
} | ||
rest_vpc_links = [ | ||
{ | ||
name = "rest-vpc-link1-dev" | ||
description = "VPC Link for development REST APIs." | ||
target_arns = [dependency.internal_nlb_1.outputs.lb_arn] | ||
} | ||
] | ||
include { | ||
path = find_in_parent_folders() | ||
tags = local.tags | ||
} | ||
dependency "internal_nlb_1" { | ||
config_path = "../nlb/internal/1" | ||
``` | ||
### Terragrunt Basic Example (HTTP) | ||
``` | ||
terraform { | ||
source = "git::[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
} | ||
dependency "internal_nlb_2" { | ||
config_path = "../nlb/internal/2" | ||
} | ||
inputs = { | ||
create_rest_vpc_links = false | ||
create_http_vpc_links = true | ||
dependency "vpc" { | ||
config_path = "../vpc" | ||
} | ||
http_vpc_links = [ | ||
{ | ||
name = "http-vpc-link1-dev" | ||
security_group_ids = [dependency.vpc.outputs.default_security_group_id] | ||
subnet_ids = dependency.vpc.outputs.private_subnets | ||
} | ||
] | ||
tags = local.tags | ||
} | ||
``` | ||
### Terragrunt Complete Example | ||
``` | ||
terraform { | ||
source = "git::[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.0" | ||
source = "git::[email protected]:adamwshero/terraform-aws-api-gateway-vpc-link.git//.?ref=1.0.2" | ||
} | ||
inputs = { | ||
|
@@ -71,67 +78,4 @@ inputs = { | |
tags = local.tags | ||
} | ||
``` | ||
<br> | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.67.0 | | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 | ||
| <a name="requirement_terragrunt"></a> [terragrunt](#requirement\_terragrunt) | >= 0.28.0 | | ||
|
||
<br> | ||
|
||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.30.0 | | ||
|
||
<br> | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [apigateway_vpc_link.rsm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_vpc_link) | resource | | ||
| [apigatewayv2_vpc_link.rsm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_vpc_link) | resource | | ||
|
||
## Available Inputs | ||
|
||
| Name | Resource | Variable | Data Type | Default | Required? | ||
| ----------------------------- | ----------------------- | -------------------- | --------- | ------- | -------- | | ||
| REST VPC Link Name | `apigateway_vpc_link` | `name` | `string` | `null` | Yes | | ||
| REST VPC Link Description | `apigateway_vpc_link` | `description` | `string` | `null` | No | | ||
| REST NLB Target Arns | `apigateway_vpc_link` | `target_arns` | `string` | `null` | Yes | | ||
| HTTP VPC Link Name | `apigatewayv2_vpc_link` | `name` | `string` | `null` | Yes | | ||
| HTTP VPC Link Security Groups | `apigatewayv2_vpc_link` | `security_group_ids` | `string` | `null` | Yes | | ||
| HTTP VPC Link Subnet Ids | `apigatewayv2_vpc_link` | `subnet_ids` | `string` | `null` | Yes | | ||
|
||
## Predetermined Inputs | ||
|
||
| Name | Resource | Property | Data Type | Default | Required? | ||
| -------------------- | ---------------------- | ---------- | --------- | ------- | -------- | | ||
| | | | | | | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------------------------------------------|--------------------------------------- | | ||
| apigateway_vpc_link.id | Id of the REST VPC Link. | | ||
| apigateway_vpc_link.name | Name of the REST VPC Link. | | ||
| apigateway_vpc_link.description | Description of the REST VPC Link. | | ||
| apigateway_vpc_link.target_arns | NLB Arns of the REST VPC link. | | ||
| apigatewayv2_vpc_link.name | Name of the HTTP VPC Link. | | ||
| apigatewayv2_vpc_link.security_group_ids | Security Groups for the HTTP VPC link. | | ||
| apigatewayv2_vpc_link.subnet_ids | Subnet Ids for the HTTP VPC link. | | ||
|
||
## Supporting Articles & Documentation | ||
- AWS Hyperplane and AWS PrivateLink | ||
- https://aws.amazon.com/blogs/compute/understanding-vpc-links-in-amazon-api-gateway-private-integrations/ | ||
- Building private cross-account APIs using Amazon API Gateway and AWS PrivateLink | ||
- https://aws.amazon.com/blogs/compute/building-private-cross-account-apis-using-amazon-api-gateway-and-aws-privatelink/ | ||
|
||
``` |
Oops, something went wrong.