Skip to content

Commit 44e6eaa

Browse files
tcharewiczTomasz Charewiczantonbabenkobryantbiggs
authored
feat!: Support enabling NAU metrics in "aws_vpc" resource (#838)
Co-authored-by: Tomasz Charewicz <[email protected]> Co-authored-by: Anton Babenko <[email protected]> Co-authored-by: Bryant Biggs <[email protected]>
1 parent 7010e70 commit 44e6eaa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3301
-1992
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.77.0
3+
rev: v1.77.1
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate

README.md

Lines changed: 102 additions & 65 deletions
Large diffs are not rendered by default.

UPGRADE-4.0.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Upgrade from v3.x to v4.x
2+
3+
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:
4+
5+
If you find a bug, please open an issue with supporting configuration to reproduce.
6+
7+
## List of backwards incompatible changes
8+
9+
- The minimum required Terraform version is now 1.0
10+
- The minimum required AWS provider version is now 4.x (4.35.0 at time of writing)
11+
- `assign_ipv6_address_on_creation` has been removed; use the respective subnet type equivalent instead (i.e. - `public_subnet_assign_ipv6_address_on_creation`)
12+
- `enable_classiclink` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730
13+
- `enable_classiclink_dns_support` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730
14+
15+
## Additional changes
16+
17+
### Modified
18+
19+
- `map_public_ip_on_launch` now defaults to `false`
20+
- `enable_dns_hostnames` now defaults to `true`
21+
- `enable_dns_support` now defaults to `true`
22+
- `manage_default_security_group` now defaults to `true`
23+
- `manage_default_route_table` now defaults to `true`
24+
- `manage_default_network_acl` now defaults to `true`
25+
- 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
26+
- The default fallback value for outputs has changed from an empty string to `null`
27+
28+
### Variable and output changes
29+
30+
1. Removed variables:
31+
32+
- `assign_ipv6_address_on_creation` has been removed; use the respective subnet type equivalent instead (i.e. - `public_subnet_assign_ipv6_address_on_creation`)
33+
- `enable_classiclink` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730
34+
- `enable_classiclink_dns_support` has been removed; it is no longer supported by AWS https://github.com/hashicorp/terraform/issues/31730
35+
36+
2. Renamed variables:
37+
38+
- None
39+
40+
3. Added variables:
41+
42+
- VPC
43+
- `ipv6_cidr_block_network_border_group`
44+
- `enable_network_address_usage_metrics`
45+
- Subnets
46+
- `*_subnet_enable_dns64` for each subnet type
47+
- `*_subnet_enable_resource_name_dns_aaaa_record_on_launch` for each subnet type
48+
- `*_subnet_enable_resource_name_dns_a_record_on_launch` for each subnet type
49+
- `*_subnet_ipv6_native` for each subnet type
50+
- `*_subnet_private_dns_hostname_type_on_launch` for each subnet type
51+
52+
4. Removed outputs:
53+
54+
- None
55+
56+
5. Renamed outputs:
57+
58+
- None
59+
60+
6. Added outputs:
61+
62+
- None
63+
64+
### State Changes
65+
66+
None

examples/complete-vpc/README.md renamed to examples/complete/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2121

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

2727
## Providers
2828

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

3333
## Modules
3434

@@ -43,6 +43,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
4343
| Name | Type |
4444
|------|------|
4545
| [aws_security_group.vpc_tls](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
46+
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
4647
| [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
4748
| [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
4849
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |

examples/complete-vpc/main.tf renamed to examples/complete/main.tf

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ provider "aws" {
22
region = local.region
33
}
44

5+
data "aws_availability_zones" "available" {}
6+
57
locals {
6-
name = "ex-${replace(basename(path.cwd), "_", "-")}"
8+
name = "ex-${basename(path.cwd)}"
79
region = "eu-west-1"
810

11+
vpc_cidr = "10.0.0.0/16"
12+
azs = slice(data.aws_availability_zones.available.names, 0, 3)
13+
914
tags = {
1015
Example = local.name
1116
GithubRepo = "terraform-aws-vpc"
@@ -21,15 +26,15 @@ module "vpc" {
2126
source = "../../"
2227

2328
name = local.name
24-
cidr = "10.0.0.0/16"
29+
cidr = local.vpc_cidr
2530

26-
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
27-
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
28-
public_subnets = ["10.0.11.0/24", "10.0.12.0/24", "10.0.13.0/24"]
29-
database_subnets = ["10.0.21.0/24", "10.0.22.0/24", "10.0.23.0/24"]
30-
elasticache_subnets = ["10.0.31.0/24", "10.0.32.0/24", "10.0.33.0/24"]
31-
redshift_subnets = ["10.0.41.0/24", "10.0.42.0/24", "10.0.43.0/24"]
32-
intra_subnets = ["10.0.51.0/24", "10.0.52.0/24", "10.0.53.0/24"]
31+
azs = local.azs
32+
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
33+
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]
34+
database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]
35+
elasticache_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)]
36+
redshift_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)]
37+
intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]
3338

3439
private_subnet_names = ["Private Subnet One", "Private Subnet Two"]
3540
# public_subnet_names omitted to show default name generation for all three subnets
@@ -38,16 +43,10 @@ module "vpc" {
3843
redshift_subnet_names = ["Redshift Subnet One", "Redshift Subnet Two", "Redshift Subnet Three"]
3944
intra_subnet_names = []
4045

41-
create_database_subnet_group = false
42-
43-
manage_default_network_acl = true
44-
default_network_acl_tags = { Name = "${local.name}-default" }
45-
46-
manage_default_route_table = true
47-
default_route_table_tags = { Name = "${local.name}-default" }
48-
49-
manage_default_security_group = true
50-
default_security_group_tags = { Name = "${local.name}-default" }
46+
create_database_subnet_group = false
47+
manage_default_network_acl = false
48+
manage_default_route_table = false
49+
manage_default_security_group = false
5150

5251
enable_dns_hostnames = true
5352
enable_dns_support = true
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 0.13.1"
2+
required_version = ">= 1.0"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.73"
7+
version = ">= 4.35"
88
}
99
}
1010
}

examples/ipam-vpc/README.md renamed to examples/ipam/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2929

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

3535
## Providers
3636

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

4141
## Modules
4242

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

5859
## Inputs
5960

examples/ipam-vpc/main.tf renamed to examples/ipam/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ provider "aws" {
22
region = local.region
33
}
44

5+
data "aws_availability_zones" "available" {}
6+
57
locals {
6-
name = "ex-${replace(basename(path.cwd), "_", "-")}"
8+
name = "ex-${basename(path.cwd)}"
79
region = "eu-west-1"
810

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

1214
tags = {
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 0.13.1"
2+
required_version = ">= 1.0"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.73"
7+
version = ">= 4.35"
88
}
99
}
1010
}

examples/ipv6/README.md renamed to examples/ipv6-dualstack/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP
1919

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

2525
## Providers
2626

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

2931
## Modules
3032

@@ -34,7 +36,9 @@ No providers.
3436

3537
## Resources
3638

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

3943
## Inputs
4044

examples/ipv6-dualstack/main.tf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
provider "aws" {
2+
region = local.region
3+
}
4+
5+
data "aws_availability_zones" "available" {}
6+
7+
locals {
8+
name = "ex-${basename(path.cwd)}"
9+
region = "eu-west-1"
10+
11+
vpc_cidr = "10.0.0.0/16"
12+
azs = slice(data.aws_availability_zones.available.names, 0, 3)
13+
14+
tags = {
15+
Example = local.name
16+
GithubRepo = "terraform-aws-vpc"
17+
GithubOrg = "terraform-aws-modules"
18+
}
19+
}
20+
21+
################################################################################
22+
# VPC Module
23+
################################################################################
24+
25+
module "vpc" {
26+
source = "../.."
27+
28+
name = local.name
29+
cidr = local.vpc_cidr
30+
31+
azs = local.azs
32+
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
33+
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]
34+
database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]
35+
36+
enable_nat_gateway = false
37+
38+
create_database_subnet_route_table = true
39+
create_database_internet_gateway_route = true
40+
41+
enable_ipv6 = true
42+
public_subnet_assign_ipv6_address_on_creation = true
43+
44+
public_subnet_ipv6_prefixes = [0, 1, 2]
45+
private_subnet_ipv6_prefixes = [3, 4, 5]
46+
database_subnet_ipv6_prefixes = [6, 7, 8]
47+
48+
tags = local.tags
49+
}
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 0.13.1"
2+
required_version = ">= 1.0"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.73"
7+
version = ">= 4.35"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)