Skip to content

Commit bac41ed

Browse files
committed
refactor: remove existing vpc endpoint configurations from base module and move into sub-module
BREAKING: VPC endpoint resources are removed in favor of sub-module and `for_each` creation of any VPC endpoints BREAKING: AWS provider has been updated from v2.70 to v3.15 for VPC endpoint changes and available attributes
1 parent 43edd44 commit bac41ed

Some content is hidden

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

60 files changed

+1504
-6388
lines changed

README.md

Lines changed: 385 additions & 1066 deletions
Large diffs are not rendered by default.

UPGRADE-3.0.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Upgrade from v2.x to v3.x
2+
3+
If you have any questions regarding this upgrade process, please consult the `examples` directory:
4+
5+
- [Complete-VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc)
6+
7+
If you find a bug, please open an issue with supporting configuration to reproduce.
8+
9+
## List of backwards incompatible changes
10+
11+
Previously, VPC endpoints were configured as standalone resources with their own set of variables and attributes. Now, this functionality is provided via a module which loops over a map of maps using `for_each` to generate the desired VPC endpoints. Therefore, to maintain the existing set of functionality while upgrading, you will need to perform the following changes:
12+
13+
1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:
14+
15+
```
16+
tf state mv 'module.vpc.aws_vpc_endpoint.ssm[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this["ssm"]'
17+
tf state mv 'module.vpc.aws_vpc_endpoint.ssmmessages[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this["ssmmessages"]'
18+
tf state mv 'module.vpc.aws_vpc_endpoint.ec2[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this["ec2"]'
19+
...
20+
```
21+
22+
2. Remove the gateway endpoint route table association separate resources. The route table associations are now managed in the VPC endpoint resource itself via the map of maps provided to the VPC endpoint sub-module. Perform the necessary removals for each route table association and for S3 and/or DynamoDB depending on your configuration:
23+
24+
```
25+
tf state rm 'module.vpc.aws_vpc_endpoint_route_table_association.intra_dynamodb[0]'
26+
tf state rm 'module.vpc.aws_vpc_endpoint_route_table_association.private_dynamodb[0]'
27+
tf state rm 'module.vpc.aws_vpc_endpoint_route_table_association.public_dynamodb[0]'
28+
...
29+
```
30+
31+
### Variable and output changes
32+
33+
1. Removed variables:
34+
35+
- `enable_*_endpoint`
36+
- `*_endpoint_type`
37+
- `*_endpoint_security_group_ids`
38+
- `*_endpoint_subnet_ids`
39+
- `*_endpoint_private_dns_enabled`
40+
- `*_endpoint_policy`
41+
42+
2. Renamed variables:
43+
44+
See the [VPC endpoint sub-module](modules/vpc-endpoints) for the more information on the variables to utilize for VPC endpoints
45+
46+
- None
47+
48+
3. Removed outputs:
49+
50+
- `vpc_endpoint_*`
51+
52+
4. Renamed outputs:
53+
54+
VPC endpoint outputs are now provided via the VPC endpoint sub-module and can be accessed via lookups. See [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc) for further examples of how to access VPC endpoint attributes from outputs.
55+
56+
- None

examples/complete-vpc/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ 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.12.21 |
25-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.10 |
24+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
25+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |
2626

2727
## Providers
2828

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

3333
## Modules
3434

3535
| Name | Source | Version |
3636
|------|--------|---------|
3737
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | |
38+
| <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | ../../modules/vpc-endpoints | |
3839

3940
## Resources
4041

@@ -43,7 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
4344
| [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
4445
| [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
4546
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |
46-
| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |
47+
| [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |
4748

4849
## Inputs
4950

0 commit comments

Comments
 (0)