Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Support enabling NAU metrics in "aws_vpc" resource #838

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3be42c2
adding variable enable_network_address_usage_metrics
Oct 11, 2022
b38e25d
remove dot from description
Oct 11, 2022
6bdb895
Merge branch 'master' into enable_nau_metrics
antonbabenko Oct 21, 2022
52c9fc8
Merge branch 'master' into enable_nau_metrics
antonbabenko Jan 3, 2023
5245e46
Merge branch 'master' into enable_nau_metrics
antonbabenko Jan 3, 2023
9864c19
Merge branch 'master' into enable_nau_metrics
bryantbiggs Feb 8, 2023
df791ab
feat: Update min required versions consistently, remove classiclink a…
bryantbiggs Feb 8, 2023
7830449
refactor: Update default settings for DNS hostnames and map public IP…
bryantbiggs Feb 8, 2023
e75d008
chore: Update outputs to use long form for list
bryantbiggs Feb 9, 2023
a8de9c5
feat: Update subnets to use latest available arguments
bryantbiggs Feb 10, 2023
e4d85ef
fix: Remove validation on flow log file format which is causing an error
bryantbiggs Feb 10, 2023
ae36e7f
chore: Clean up example name syntax
bryantbiggs Feb 10, 2023
5ac5842
feat: Add upgrade guide
bryantbiggs Feb 10, 2023
624b954
chore: Update examples to use AZ data source and cidrsubnet() function
bryantbiggs Feb 10, 2023
f23c52f
feat: Add IPv6 only example
bryantbiggs Feb 11, 2023
447a432
fix: RDS subnet groups are dualstack only
bryantbiggs Feb 11, 2023
a29763a
chore: Updates from testing
bryantbiggs Feb 11, 2023
65f1d29
chore: Updates from PR review feedback
bryantbiggs Feb 18, 2023
190f197
Merge branch 'master' of github.com:bryantbiggs/terraform-aws-vpc int…
bryantbiggs Apr 5, 2023
28fb8fa
chore: Update example to show default resources not being managed
bryantbiggs Apr 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.0
rev: v1.77.1
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand Down
167 changes: 102 additions & 65 deletions README.md

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Upgrade from v3.x to v4.x

If you have any questions regarding this upgrade process, please consult the [`examples`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/) directory:

If you find a bug, please open an issue with supporting configuration to reproduce.

## List of backwards incompatible changes

- The minimum required Terraform version is now 1.0
- The minimum required AWS provider version is now 4.x (4.35.0 at time of writing)
- `assign_ipv6_address_on_creation` has been removed; use the respective subnet type equivalent instead (i.e. - `public_subnet_assign_ipv6_address_on_creation`)
- `enable_classiclink` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730
- `enable_classiclink_dns_support` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730

## Additional changes

### Modified

- `map_public_ip_on_launch` now defaults to `false`
- `enable_dns_hostnames` now defaults to `true`
- `enable_dns_support` now defaults to `true`
- `manage_default_security_group` now defaults to `true`
antonbabenko marked this conversation as resolved.
Show resolved Hide resolved
- `manage_default_route_table` now defaults to `true`
- `manage_default_network_acl` now defaults to `true`
antonbabenko marked this conversation as resolved.
Show resolved Hide resolved
- The default name for the default security group, route table, and network ACL has changed to fallback to append `-default` to the VPC name if a specific name is not provided
- The default fallback value for outputs has changed from an empty string to `null`

### Variable and output changes

1. Removed variables:

- `assign_ipv6_address_on_creation` has been removed; use the respective subnet type equivalent instead (i.e. - `public_subnet_assign_ipv6_address_on_creation`)
- `enable_classiclink` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730
- `enable_classiclink_dns_support` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730

2. Renamed variables:

- None

3. Added variables:

- VPC
- `ipv6_cidr_block_network_border_group`
- `enable_network_address_usage_metrics`
- Subnets
- `*_subnet_enable_dns64` for each subnet type
- `*_subnet_enable_resource_name_dns_aaaa_record_on_launch` for each subnet type
- `*_subnet_enable_resource_name_dns_a_record_on_launch` for each subnet type
- `*_subnet_ipv6_native` for each subnet type
- `*_subnet_private_dns_hostname_type_on_launch` for each subnet type

4. Removed outputs:

- None

5. Renamed outputs:

- None

6. Added outputs:

- None

### State Changes

None
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.35 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.35 |

## Modules

Expand All @@ -43,6 +43,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Type |
|------|------|
| [aws_security_group.vpc_tls](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
| [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |
Expand Down
25 changes: 15 additions & 10 deletions examples/complete-vpc/main.tf → examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ provider "aws" {
region = local.region
}

data "aws_availability_zones" "available" {}

locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
name = "ex-${basename(path.cwd)}"
region = "eu-west-1"

vpc_cidr = "10.0.0.0/16"
azs = slice(data.aws_availability_zones.available.names, 0, 3)

tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
Expand All @@ -21,15 +26,15 @@ module "vpc" {
source = "../../"

name = local.name
cidr = "10.0.0.0/16"

azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.11.0/24", "10.0.12.0/24", "10.0.13.0/24"]
database_subnets = ["10.0.21.0/24", "10.0.22.0/24", "10.0.23.0/24"]
elasticache_subnets = ["10.0.31.0/24", "10.0.32.0/24", "10.0.33.0/24"]
redshift_subnets = ["10.0.41.0/24", "10.0.42.0/24", "10.0.43.0/24"]
intra_subnets = ["10.0.51.0/24", "10.0.52.0/24", "10.0.53.0/24"]
cidr = local.vpc_cidr

azs = local.azs
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]
database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]
elasticache_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)]
redshift_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)]
intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]

private_subnet_names = ["Private Subnet One", "Private Subnet Two"]
# public_subnet_names omitted to show default name generation for all three subnets
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.73"
version = ">= 4.35"
}
}
}
7 changes: 4 additions & 3 deletions examples/ipam-vpc/README.md → examples/ipam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.35 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.35 |

## Modules

Expand All @@ -54,6 +54,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| [aws_vpc_ipam_pool.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool) | resource |
| [aws_vpc_ipam_pool_cidr.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool_cidr) | resource |
| [aws_vpc_ipam_preview_next_cidr.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_preview_next_cidr) | resource |
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |

## Inputs

Expand Down
6 changes: 4 additions & 2 deletions examples/ipam-vpc/main.tf → examples/ipam/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ provider "aws" {
region = local.region
}

data "aws_availability_zones" "available" {}

locals {
name = "ex-${replace(basename(path.cwd), "_", "-")}"
name = "ex-${basename(path.cwd)}"
region = "eu-west-1"

azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
azs = slice(data.aws_availability_zones.available.names, 0, 3)
preview_partition = cidrsubnets(aws_vpc_ipam_preview_next_cidr.this.cidr, 2, 2, 2)

tags = {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions examples/ipv6/versions.tf → examples/ipam/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.73"
version = ">= 4.35"
}
}
}
12 changes: 8 additions & 4 deletions examples/ipv6/README.md → examples/ipv6-dualstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.35 |

## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.35 |

## Modules

Expand All @@ -34,7 +36,9 @@ No providers.

## Resources

No resources.
| Name | Type |
|------|------|
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |

## Inputs

Expand Down
49 changes: 49 additions & 0 deletions examples/ipv6-dualstack/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
provider "aws" {
region = local.region
}

data "aws_availability_zones" "available" {}

locals {
name = "ex-${basename(path.cwd)}"
region = "eu-west-1"

vpc_cidr = "10.0.0.0/16"
azs = slice(data.aws_availability_zones.available.names, 0, 3)

tags = {
Example = local.name
GithubRepo = "terraform-aws-vpc"
GithubOrg = "terraform-aws-modules"
}
}

################################################################################
# VPC Module
################################################################################

module "vpc" {
source = "../.."

name = local.name
cidr = local.vpc_cidr

azs = local.azs
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]
database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]

enable_nat_gateway = false

create_database_subnet_route_table = true
create_database_internet_gateway_route = true

enable_ipv6 = true
public_subnet_assign_ipv6_address_on_creation = true

public_subnet_ipv6_prefixes = [0, 1, 2]
private_subnet_ipv6_prefixes = [3, 4, 5]
database_subnet_ipv6_prefixes = [6, 7, 8]

tags = local.tags
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.73"
version = ">= 4.35"
}
}
}
Loading