UPD: adding cwl log group class variable for flowlog
This commit is contained in:
parent
eb01ee1c4f
commit
a83c9575dc
@ -1,3 +1,4 @@
|
||||
<!-- This readme file is generated with terraform-docs -->
|
||||
# Overview
|
||||
This module performs the following tasks:
|
||||
|
||||
@ -5,48 +6,83 @@ This module performs the following tasks:
|
||||
- Create subnets in every AZ
|
||||
- Create IGW, NGW
|
||||
- Create s3 and ddb endpoints which are free
|
||||
-
|
||||
## Requirements
|
||||
|
||||
## Subnet addressing
|
||||
No requirements.
|
||||
|
||||
Subnet cidrs needs to be specified manually
|
||||
## Providers
|
||||
|
||||
## Inputs:
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| aws | n/a |
|
||||
| random | n/a |
|
||||
|
||||
## Modules
|
||||
|
||||
| Name | Source | Version |
|
||||
|------|--------|---------|
|
||||
| vpc-ep | ../vpc-endpoints | n/a |
|
||||
|
||||
## Resources
|
||||
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| [aws_cloudwatch_log_group.vpcflowlog-loggroup](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
|
||||
| [aws_default_security_group.default-sg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) | resource |
|
||||
| [aws_eip.ngw-eip](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |
|
||||
| [aws_flow_log.vpc-flowlog](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource |
|
||||
| [aws_iam_role.vpcflowlog-role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
|
||||
| [aws_iam_role_policy.vpcflowlog-role-policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
|
||||
| [aws_internet_gateway.igw](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway) | resource |
|
||||
| [aws_nat_gateway.ngw](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/nat_gateway) | resource |
|
||||
| [aws_route.private-routes](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |
|
||||
| [aws_route.public-routes](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |
|
||||
| [aws_route_table.private-route-table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table) | resource |
|
||||
| [aws_route_table.public-route-table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table) | resource |
|
||||
| [aws_route_table_association.private_route_association](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table_association) | resource |
|
||||
| [aws_route_table_association.public_route_association](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table_association) | resource |
|
||||
| [aws_subnet.private-subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet) | resource |
|
||||
| [aws_subnet.public-subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet) | resource |
|
||||
| [aws_vpc.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc) | resource |
|
||||
| [aws_vpc_ipv4_cidr_block_association.additional_cidr](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipv4_cidr_block_association) | resource |
|
||||
| [random_id.rid](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
|
||||
| [aws_availability_zones.available-az](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
|
||||
| [aws_caller_identity.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
|
||||
| [aws_default_tags.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/default_tags) | data source |
|
||||
|
||||
## 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 |
|
||||
|------|-------------|------|---------|:--------:|
|
||||
| create-free-vpc-endpoints | variable "private-subnet-cidrs" {} variable "public-subnet-cidrs" {} | `bool` | `true` | no |
|
||||
| create-nat-gateway | n/a | `bool` | `false` | no |
|
||||
| enable-flow-log | n/a | `bool` | `true` | no |
|
||||
| log-group-class | Log group class for flowlog cloudwatch log group, which can be STANDARD or INFREQUENT\_ACCESS | `string` | `"STANDARD"` | no |
|
||||
| num\_azs | By default, use 2 AZs for redundancy | `number` | `2` | no |
|
||||
| private-subnet-cidrs | n/a | `list(any)` | n/a | yes |
|
||||
| public-subnet-cidrs | n/a | `list(any)` | n/a | yes |
|
||||
| resource-prefix | n/a | `any` | n/a | yes |
|
||||
| secondary\_cidr\_blocks | Additional cidr blocks | `list(string)` | `[]` | no |
|
||||
| vpc-cidr | VPC variables | `any` | n/a | yes |
|
||||
| vpcflowlog-cwl-loggroup-key-arn | n/a | `any` | n/a | yes |
|
||||
| vpcflowlog-retain-days | n/a | `number` | `90` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
## Outputs:
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| private-route-table-id | n/a |
|
||||
| private-subnet-ids | n/a |
|
||||
| private\_subnets | n/a |
|
||||
| public-route-table-id | n/a |
|
||||
| public-subnet-ids | n/a |
|
||||
| public\_subnets | n/a |
|
||||
| route\_tables\_for\_gateway\_endpoints | n/a |
|
||||
| secondary\_cidr\_blocks | n/a |
|
||||
| vpc-cidr | n/a |
|
||||
| vpc\_id | n/a |
|
||||
|
||||
| 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 |
|
||||
|
||||
## 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
|
||||
}
|
||||
```
|
||||
---
|
||||
## Authorship
|
||||
This module was developed by xpk.
|
@ -1,4 +1,4 @@
|
||||
variable resource-prefix {}
|
||||
variable "resource-prefix" {}
|
||||
|
||||
# VPC variables
|
||||
variable "vpc-cidr" {}
|
||||
@ -36,8 +36,14 @@ variable "secondary_cidr_blocks" {
|
||||
default = []
|
||||
}
|
||||
|
||||
variable num_azs {
|
||||
variable "num_azs" {
|
||||
description = "By default, use 2 AZs for redundancy"
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
|
||||
variable "log-group-class" {
|
||||
description = "Log group class for flowlog cloudwatch log group, which can be STANDARD or INFREQUENT_ACCESS"
|
||||
type = string
|
||||
default = "STANDARD"
|
||||
}
|
@ -12,10 +12,10 @@ resource "aws_flow_log" "vpc-flowlog" {
|
||||
resource "aws_cloudwatch_log_group" "vpcflowlog-loggroup" {
|
||||
count = var.enable-flow-log ? 1 : 0
|
||||
|
||||
name_prefix = "vpcflowlog/${aws_vpc.vpc.id}/"
|
||||
name_prefix = "/aws/vpcflowlog/"
|
||||
kms_key_id = var.vpcflowlog-cwl-loggroup-key-arn
|
||||
|
||||
retention_in_days = var.vpcflowlog-retain-days
|
||||
log_group_class = var.log-group-class
|
||||
}
|
||||
|
||||
resource "random_id" "rid" {
|
||||
|
Loading…
Reference in New Issue
Block a user