From 12886f497fa53551a4608a92d239008d5ffe91f5 Mon Sep 17 00:00:00 2001 From: Mark Johnson <739719+virgofx@users.noreply.github.com> Date: Sat, 27 May 2023 16:39:11 -0700 Subject: [PATCH 1/2] Use `domain` attribute instead of deprecate `vpc` argument. The `vpc` attribute has been deprecated and starting with AWS Terraform Provider v5.0 this will report a deprecation warning. The new `domain` parameter has similar functionality while removing EC2-classic support. --- UPGRADE-5.0.md | 23 +++++++++++++++++++++++ main.tf | 2 +- versions.tf | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 UPGRADE-5.0.md diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md new file mode 100644 index 000000000..d66d915b4 --- /dev/null +++ b/UPGRADE-5.0.md @@ -0,0 +1,23 @@ +# Upgrade from v4.x to v5.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 AWS provider version is now 5.x (5.0.0 at time of writing) + +## Additional changes + +### Modified + +None + +### Variable and output changes + +None + +### State Changes + +None diff --git a/main.tf b/main.tf index d72fe5d91..d01af3716 100644 --- a/main.tf +++ b/main.tf @@ -1041,7 +1041,7 @@ locals { resource "aws_eip" "nat" { count = local.create_vpc && var.enable_nat_gateway && !var.reuse_nat_ips ? local.nat_gateway_count : 0 - vpc = true + domain = true tags = merge( { diff --git a/versions.tf b/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } From 3d33279971f4319c997e9068f54710c9e229ed81 Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Tue, 30 May 2023 11:15:57 -0400 Subject: [PATCH 2/2] chore: Update versions to align on v5.0 --- .pre-commit-config.yaml | 2 +- README.md | 4 ++-- UPGRADE-5.0.md | 23 ---------------------- examples/complete/README.md | 4 ++-- examples/complete/versions.tf | 2 +- examples/ipam/README.md | 4 ++-- examples/ipam/versions.tf | 2 +- examples/ipv6-dualstack/README.md | 4 ++-- examples/ipv6-dualstack/versions.tf | 2 +- examples/ipv6-only/README.md | 4 ++-- examples/ipv6-only/versions.tf | 2 +- examples/issues/README.md | 4 ++-- examples/issues/versions.tf | 2 +- examples/manage-default-vpc/README.md | 2 +- examples/manage-default-vpc/versions.tf | 2 +- examples/network-acls/README.md | 4 ++-- examples/network-acls/versions.tf | 2 +- examples/outpost/README.md | 4 ++-- examples/outpost/versions.tf | 2 +- examples/secondary-cidr-blocks/README.md | 4 ++-- examples/secondary-cidr-blocks/versions.tf | 2 +- examples/separate-route-tables/README.md | 4 ++-- examples/separate-route-tables/versions.tf | 2 +- examples/simple/README.md | 4 ++-- examples/simple/versions.tf | 2 +- examples/vpc-flow-logs/README.md | 4 ++-- examples/vpc-flow-logs/versions.tf | 2 +- main.tf | 4 +++- modules/vpc-endpoints/README.md | 4 ++-- modules/vpc-endpoints/versions.tf | 2 +- 30 files changed, 44 insertions(+), 65 deletions(-) delete mode 100644 UPGRADE-5.0.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 071427d75..4395e67e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.77.1 + rev: v1.79.1 hooks: - id: terraform_fmt - id: terraform_validate diff --git a/README.md b/README.md index ec0a907a3..7ecb6b51c 100644 --- a/README.md +++ b/README.md @@ -256,13 +256,13 @@ Full contributing [guidelines are covered here](.github/contributing.md). | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md deleted file mode 100644 index d66d915b4..000000000 --- a/UPGRADE-5.0.md +++ /dev/null @@ -1,23 +0,0 @@ -# Upgrade from v4.x to v5.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 AWS provider version is now 5.x (5.0.0 at time of writing) - -## Additional changes - -### Modified - -None - -### Variable and output changes - -None - -### State Changes - -None diff --git a/examples/complete/README.md b/examples/complete/README.md index 0111e82a0..96242c225 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/ipam/README.md b/examples/ipam/README.md index 1ebc7eb55..07373875a 100644 --- a/examples/ipam/README.md +++ b/examples/ipam/README.md @@ -30,13 +30,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/ipam/versions.tf b/examples/ipam/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/ipam/versions.tf +++ b/examples/ipam/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/ipv6-dualstack/README.md b/examples/ipv6-dualstack/README.md index 942a71cb5..3318683ec 100644 --- a/examples/ipv6-dualstack/README.md +++ b/examples/ipv6-dualstack/README.md @@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/ipv6-dualstack/versions.tf b/examples/ipv6-dualstack/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/ipv6-dualstack/versions.tf +++ b/examples/ipv6-dualstack/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/ipv6-only/README.md b/examples/ipv6-only/README.md index 1ce72714b..eb8cea2e0 100644 --- a/examples/ipv6-only/README.md +++ b/examples/ipv6-only/README.md @@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/ipv6-only/versions.tf b/examples/ipv6-only/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/ipv6-only/versions.tf +++ b/examples/ipv6-only/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/issues/README.md b/examples/issues/README.md index d63c00636..92cc3a4ca 100644 --- a/examples/issues/README.md +++ b/examples/issues/README.md @@ -25,13 +25,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/issues/versions.tf b/examples/issues/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/issues/versions.tf +++ b/examples/issues/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/manage-default-vpc/README.md b/examples/manage-default-vpc/README.md index 2943f2a4f..0c506f33f 100644 --- a/examples/manage-default-vpc/README.md +++ b/examples/manage-default-vpc/README.md @@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers diff --git a/examples/manage-default-vpc/versions.tf b/examples/manage-default-vpc/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/manage-default-vpc/versions.tf +++ b/examples/manage-default-vpc/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/network-acls/README.md b/examples/network-acls/README.md index c4f9fd0d0..4e6ca7a0c 100644 --- a/examples/network-acls/README.md +++ b/examples/network-acls/README.md @@ -24,13 +24,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/network-acls/versions.tf b/examples/network-acls/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/network-acls/versions.tf +++ b/examples/network-acls/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/outpost/README.md b/examples/outpost/README.md index 772268e80..8c7173bb9 100644 --- a/examples/outpost/README.md +++ b/examples/outpost/README.md @@ -24,13 +24,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/outpost/versions.tf b/examples/outpost/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/outpost/versions.tf +++ b/examples/outpost/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/secondary-cidr-blocks/README.md b/examples/secondary-cidr-blocks/README.md index 86536ec76..5054d43f9 100644 --- a/examples/secondary-cidr-blocks/README.md +++ b/examples/secondary-cidr-blocks/README.md @@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/secondary-cidr-blocks/versions.tf b/examples/secondary-cidr-blocks/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/secondary-cidr-blocks/versions.tf +++ b/examples/secondary-cidr-blocks/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/separate-route-tables/README.md b/examples/separate-route-tables/README.md index 328e501ec..57ee751f9 100644 --- a/examples/separate-route-tables/README.md +++ b/examples/separate-route-tables/README.md @@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/separate-route-tables/versions.tf b/examples/separate-route-tables/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/separate-route-tables/versions.tf +++ b/examples/separate-route-tables/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/simple/README.md b/examples/simple/README.md index 0f8a665f1..0d5658b4a 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -26,13 +26,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/examples/simple/versions.tf b/examples/simple/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/examples/simple/versions.tf +++ b/examples/simple/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } } diff --git a/examples/vpc-flow-logs/README.md b/examples/vpc-flow-logs/README.md index 89edcc0f0..d0cb120a8 100644 --- a/examples/vpc-flow-logs/README.md +++ b/examples/vpc-flow-logs/README.md @@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/vpc-flow-logs/versions.tf b/examples/vpc-flow-logs/versions.tf index e7837022e..383652286 100644 --- a/examples/vpc-flow-logs/versions.tf +++ b/examples/vpc-flow-logs/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } random = { diff --git a/main.tf b/main.tf index d01af3716..25fb194e4 100644 --- a/main.tf +++ b/main.tf @@ -1041,7 +1041,7 @@ locals { resource "aws_eip" "nat" { count = local.create_vpc && var.enable_nat_gateway && !var.reuse_nat_ips ? local.nat_gateway_count : 0 - domain = true + domain = "vpc" tags = merge( { @@ -1053,6 +1053,8 @@ resource "aws_eip" "nat" { var.tags, var.nat_eip_tags, ) + + depends_on = [aws_internet_gateway.this] } resource "aws_nat_gateway" "this" { diff --git a/modules/vpc-endpoints/README.md b/modules/vpc-endpoints/README.md index f27cfdc8b..405be615f 100644 --- a/modules/vpc-endpoints/README.md +++ b/modules/vpc-endpoints/README.md @@ -56,13 +56,13 @@ module "endpoints" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.35 | +| [aws](#requirement\_aws) | >= 5.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.35 | +| [aws](#provider\_aws) | >= 5.0 | ## Modules diff --git a/modules/vpc-endpoints/versions.tf b/modules/vpc-endpoints/versions.tf index 4d4bddd64..ddfcb0e05 100644 --- a/modules/vpc-endpoints/versions.tf +++ b/modules/vpc-endpoints/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.35" + version = ">= 5.0" } } }