2023-07-12 20:37:30 +08:00
|
|
|
# Overview
|
|
|
|
This module performs the following tasks:
|
|
|
|
|
|
|
|
- Create VPC, vpcflow log
|
|
|
|
- Create subnets in every AZ
|
|
|
|
- Create IGW, NGW
|
|
|
|
- Create s3 and ddb endpoints which are free
|
|
|
|
|
|
|
|
## Subnet addressing
|
|
|
|
|
|
|
|
Subnet cidrs needs to be specified manually
|
|
|
|
|
|
|
|
## Inputs:
|
|
|
|
|
|
|
|
| Name | Description | Type | Default | Required |
|
|
|
|
|---------------------------------|---------------------------------------------------|---------------|---------|----------|
|
|
|
|
| private-subnet-cidrs | private subnets | list | [] | yes |
|
|
|
|
| public-subnet-cidrs | public subnets | list | [] | yes |
|
|
|
|
| create-nat-gateway | whether to deploy NAT gateway for private subnets | bool | true | yes |
|
|
|
|
| vpc-cidr | VPC cidr | string | none | yes |
|
|
|
|
| enable-flowlog | whether to enable vpc flowlog | bool | true | yes |
|
|
|
|
| vpcflowlog-retain-days | number of days to retain vpc cloudwatch log | number | 90 | yes |
|
|
|
|
| vpcflowlog-cwl-loggroup-key-arn | kms key alias arn for log group encryption | string | none | yes |
|
|
|
|
| secondary_cidr_blocks | Additional CIDR blocks to be associated with VPC | list(string) | none | no |
|
|
|
|
| resource-prefix | Prefix of resource name | string | "" | yes |
|
|
|
|
|
|
|
|
|
|
|
|
## Outputs:
|
|
|
|
|
|
|
|
| Name | Description | Type |
|
|
|
|
|-----------------------|-------------------------|---------|
|
|
|
|
| vpc_id | vpc id | string |
|
|
|
|
| public_subnets | list of cidr blocks | list |
|
|
|
|
| private_subnets | list of cidr blocks | list |
|
|
|
|
| secondary_cidr_blocks | list of secondary cidrs | list |
|
2023-07-12 23:04:58 +08:00
|
|
|
|
|
|
|
## Example:
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
module "vpc-subnets" {
|
|
|
|
source = "../../modules/networking/vpc-subnet-manual"
|
|
|
|
|
|
|
|
resource-prefix = local.resource-prefix
|
|
|
|
private-subnet-cidrs = ["172.17.0.0/24", "172.17.1.0/24"]
|
|
|
|
public-subnet-cidrs = ["172.17.10.0/24", "172.17.11.0/24"]
|
|
|
|
vpc-cidr = "172.17.0.0/16"
|
|
|
|
enable-flow-log = false
|
|
|
|
vpcflowlog-cwl-loggroup-key-arn = ""
|
|
|
|
create-nat-gateway = true
|
|
|
|
create-free-vpc-endpoints = true
|
|
|
|
}
|
|
|
|
```
|