Skip to content

Commit 4e8f9c9

Browse files
authored
feat: Update Terraform minimum supported version to v0.13.1 (#68)
1 parent e6ceb86 commit 4e8f9c9

File tree

14 files changed

+362
-305
lines changed

14 files changed

+362
-305
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.62.3
3+
rev: v1.64.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ module "vpc" {
6868

6969
| Name | Version |
7070
|------|---------|
71-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
72-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15.0 |
71+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
72+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |
7373

7474
## Providers
7575

7676
| Name | Version |
7777
|------|---------|
78-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.15.0 |
78+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.15 |
7979

8080
## Modules
8181

examples/complete/README.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
Configuration in this directory creates AWS Transit Gateway, attach VPC to it and share it with other AWS principals using [Resource Access Manager (RAM)](https://aws.amazon.com/ram/).
44

5-
## Notes
6-
7-
There is a famous limitation in Terraform which prevents us from using computed values in `count`. For this reason this example is using data-sources to discover already created default VPC and subnets.
8-
9-
In real-world scenario you will have to split creation of VPC (using [terraform-aws-vpc modules](https://github.com/terraform-aws-modules/terraform-aws-vpc)) and creation of TGW resources using this module.
10-
115
## Usage
126

137
To run this example you need to execute:
@@ -25,14 +19,12 @@ Note that this example may create resources which cost money. Run `terraform des
2519

2620
| Name | Version |
2721
|------|---------|
28-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
29-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.24 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |
3024

3125
## Providers
3226

33-
| Name | Version |
34-
|------|---------|
35-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.24 |
27+
No providers.
3628

3729
## Modules
3830

@@ -44,10 +36,7 @@ Note that this example may create resources which cost money. Run `terraform des
4436

4537
## Resources
4638

47-
| Name | Type |
48-
|------|------|
49-
| [aws_subnet_ids.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
50-
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
39+
No resources.
5140

5241
## Inputs
5342

examples/complete/main.tf

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
11
provider "aws" {
2-
region = "eu-west-1"
2+
region = local.region
33
}
44

5-
# See Notes in README.md for explanation regarding using data-sources and computed values
6-
data "aws_vpc" "default" {
7-
default = true
8-
}
5+
locals {
6+
name = "ex-tgw-${replace(basename(path.cwd), "_", "-")}"
7+
region = "eu-west-1"
98

10-
data "aws_subnet_ids" "this" {
11-
vpc_id = data.aws_vpc.default.id
9+
tags = {
10+
Example = local.name
11+
GithubRepo = "terraform-aws-eks"
12+
GithubOrg = "terraform-aws-transit-gateway"
13+
}
1214
}
1315

16+
################################################################################
17+
# Transit Gateway Module
18+
################################################################################
19+
1420
module "tgw" {
1521
source = "../../"
1622

17-
name = "my-tgw"
23+
name = local.name
1824
description = "My TGW shared with several other AWS accounts"
1925
amazon_side_asn = 64532
2026

21-
enable_auto_accept_shared_attachments = true # When "true" there is no need for RAM resources if using multiple AWS accounts
27+
# When "true" there is no need for RAM resources if using multiple AWS accounts
28+
enable_auto_accept_shared_attachments = true
2229

2330
vpc_attachments = {
2431
vpc1 = {
25-
vpc_id = data.aws_vpc.default.id # module.vpc1.vpc_id
26-
subnet_ids = data.aws_subnet_ids.this.ids # module.vpc1.private_subnets
27-
dns_support = true
28-
ipv6_support = true
32+
vpc_id = module.vpc1.vpc_id
33+
subnet_ids = module.vpc1.private_subnets
34+
dns_support = true
35+
ipv6_support = true
36+
2937
transit_gateway_default_route_table_association = false
3038
transit_gateway_default_route_table_propagation = false
31-
# transit_gateway_route_table_id = "tgw-rtb-073a181ee589b360f"
3239

3340
tgw_routes = [
3441
{
@@ -41,8 +48,8 @@ module "tgw" {
4148
]
4249
},
4350
vpc2 = {
44-
vpc_id = data.aws_vpc.default.id # module.vpc2.vpc_id
45-
subnet_ids = data.aws_subnet_ids.this.ids # module.vpc2.private_subnets
51+
vpc_id = module.vpc2.vpc_id
52+
subnet_ids = module.vpc2.private_subnets
4653

4754
tgw_routes = [
4855
{
@@ -59,37 +66,41 @@ module "tgw" {
5966
ram_allow_external_principals = true
6067
ram_principals = [307990089504]
6168

62-
tags = {
63-
Purpose = "tgw-complete-example"
64-
}
69+
tags = local.tags
6570
}
6671

72+
################################################################################
73+
# Supporting resources
74+
################################################################################
75+
6776
module "vpc1" {
6877
source = "terraform-aws-modules/vpc/aws"
6978
version = "~> 3.0"
7079

71-
name = "vpc1"
72-
80+
name = "${local.name}-vpc1"
7381
cidr = "10.10.0.0/16"
7482

75-
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
83+
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
7684
private_subnets = ["10.10.1.0/24", "10.10.2.0/24", "10.10.3.0/24"]
7785

7886
enable_ipv6 = true
7987
private_subnet_assign_ipv6_address_on_creation = true
8088
private_subnet_ipv6_prefixes = [0, 1, 2]
89+
90+
tags = local.tags
8191
}
8292

8393
module "vpc2" {
8494
source = "terraform-aws-modules/vpc/aws"
8595
version = "~> 3.0"
8696

87-
name = "vpc2"
88-
97+
name = "${local.name}-vpc2"
8998
cidr = "10.20.0.0/16"
9099

91-
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
100+
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
92101
private_subnets = ["10.20.1.0/24", "10.20.2.0/24", "10.20.3.0/24"]
93102

94103
enable_ipv6 = false
104+
105+
tags = local.tags
95106
}

examples/complete/outputs.tf

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# aws_ec2_transit_gateway
1+
################################################################################
2+
# Transit Gateway
3+
################################################################################
4+
25
output "ec2_transit_gateway_arn" {
36
description = "EC2 Transit Gateway Amazon Resource Name (ARN)"
47
value = module.tgw.ec2_transit_gateway_arn
58
}
69

7-
output "ec2_transit_gateway_association_default_route_table_id" {
8-
description = "Identifier of the default association route table"
9-
value = module.tgw.ec2_transit_gateway_association_default_route_table_id
10-
}
11-
1210
output "ec2_transit_gateway_id" {
1311
description = "EC2 Transit Gateway identifier"
1412
value = module.tgw.ec2_transit_gateway_id
@@ -19,45 +17,54 @@ output "ec2_transit_gateway_owner_id" {
1917
value = module.tgw.ec2_transit_gateway_owner_id
2018
}
2119

20+
output "ec2_transit_gateway_association_default_route_table_id" {
21+
description = "Identifier of the default association route table"
22+
value = module.tgw.ec2_transit_gateway_association_default_route_table_id
23+
}
24+
2225
output "ec2_transit_gateway_propagation_default_route_table_id" {
2326
description = "Identifier of the default propagation route table"
2427
value = module.tgw.ec2_transit_gateway_propagation_default_route_table_id
2528
}
2629

27-
output "ec2_transit_gateway_route_table_default_association_route_table" {
28-
description = "Boolean whether this is the default association route table for the EC2 Transit Gateway"
29-
value = module.tgw.ec2_transit_gateway_route_table_default_association_route_table
30+
################################################################################
31+
# VPC Attachment
32+
################################################################################
33+
34+
output "ec2_transit_gateway_vpc_attachment_ids" {
35+
description = "List of EC2 Transit Gateway VPC Attachment identifiers"
36+
value = module.tgw.ec2_transit_gateway_vpc_attachment_ids
3037
}
3138

32-
output "ec2_transit_gateway_route_table_default_propagation_route_table" {
33-
description = "Boolean whether this is the default propagation route table for the EC2 Transit Gateway"
34-
value = module.tgw.ec2_transit_gateway_route_table_default_propagation_route_table
39+
output "ec2_transit_gateway_vpc_attachment" {
40+
description = "Map of EC2 Transit Gateway VPC Attachment attributes"
41+
value = module.tgw.ec2_transit_gateway_vpc_attachment
3542
}
3643

37-
# aws_ec2_transit_gateway_route_table
44+
################################################################################
45+
# Route Table / Routes
46+
################################################################################
47+
3848
output "ec2_transit_gateway_route_table_id" {
3949
description = "EC2 Transit Gateway Route Table identifier"
4050
value = module.tgw.ec2_transit_gateway_route_table_id
4151
}
4252

43-
# aws_ec2_transit_gateway_route
44-
output "ec2_transit_gateway_route_ids" {
45-
description = "List of EC2 Transit Gateway Route Table identifier combined with destination"
46-
value = module.tgw.ec2_transit_gateway_route_ids
53+
output "ec2_transit_gateway_route_table_default_association_route_table" {
54+
description = "Boolean whether this is the default association route table for the EC2 Transit Gateway"
55+
value = module.tgw.ec2_transit_gateway_route_table_default_association_route_table
4756
}
4857

49-
# aws_ec2_transit_gateway_vpc_attachment
50-
output "ec2_transit_gateway_vpc_attachment_ids" {
51-
description = "List of EC2 Transit Gateway VPC Attachment identifiers"
52-
value = module.tgw.ec2_transit_gateway_vpc_attachment_ids
58+
output "ec2_transit_gateway_route_table_default_propagation_route_table" {
59+
description = "Boolean whether this is the default propagation route table for the EC2 Transit Gateway"
60+
value = module.tgw.ec2_transit_gateway_route_table_default_propagation_route_table
5361
}
5462

55-
output "ec2_transit_gateway_vpc_attachment" {
56-
description = "Map of EC2 Transit Gateway VPC Attachment attributes"
57-
value = module.tgw.ec2_transit_gateway_vpc_attachment
63+
output "ec2_transit_gateway_route_ids" {
64+
description = "List of EC2 Transit Gateway Route Table identifier combined with destination"
65+
value = module.tgw.ec2_transit_gateway_route_ids
5866
}
5967

60-
# aws_ec2_transit_gateway_route_table_association
6168
output "ec2_transit_gateway_route_table_association_ids" {
6269
description = "List of EC2 Transit Gateway Route Table Association identifiers"
6370
value = module.tgw.ec2_transit_gateway_route_table_association_ids
@@ -68,7 +75,6 @@ output "ec2_transit_gateway_route_table_association" {
6875
value = module.tgw.ec2_transit_gateway_route_table_association
6976
}
7077

71-
# aws_ec2_transit_gateway_route_table_propagation
7278
output "ec2_transit_gateway_route_table_propagation_ids" {
7379
description = "List of EC2 Transit Gateway Route Table Propagation identifiers"
7480
value = module.tgw.ec2_transit_gateway_route_table_propagation_ids
@@ -79,13 +85,15 @@ output "ec2_transit_gateway_route_table_propagation" {
7985
value = module.tgw.ec2_transit_gateway_route_table_propagation
8086
}
8187

82-
# aws_ram_resource_share
88+
################################################################################
89+
# Resource Access Manager
90+
################################################################################
91+
8392
output "ram_resource_share_id" {
8493
description = "The Amazon Resource Name (ARN) of the resource share"
8594
value = module.tgw.ram_resource_share_id
8695
}
8796

88-
# aws_ram_principal_association
8997
output "ram_principal_association_id" {
9098
description = "The Amazon Resource Name (ARN) of the Resource Share and the principal, separated by a comma"
9199
value = module.tgw.ram_principal_association_id

examples/complete/versions.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
terraform {
2-
required_version = ">= 0.12.26"
2+
required_version = ">= 0.13.1"
33

44
required_providers {
5-
aws = ">= 2.24"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 3.15"
8+
}
69
}
710
}

examples/multi-account/README.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
Configuration in this directory creates AWS Transit Gateway, attach VPC to it and share it with other AWS principals using [Resource Access Manager (RAM)](https://aws.amazon.com/ram/).
44

5-
## Notes
6-
7-
There is a famous limitation in Terraform which prevents us from using computed values in `count`. For this reason this example is using data-sources to discover already created default VPC and subnets.
8-
9-
In real-world scenario you will have to split creation of VPC (using [terraform-aws-vpc modules](https://github.com/terraform-aws-modules/terraform-aws-vpc)) and creation of TGW resources using this module.
10-
115
## Usage
126

137
To run this example you need to execute:
@@ -25,14 +19,12 @@ Note that this example may create resources which cost money. Run `terraform des
2519

2620
| Name | Version |
2721
|------|---------|
28-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
29-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.24 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |
3024

3125
## Providers
3226

33-
| Name | Version |
34-
|------|---------|
35-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.24 |
27+
No providers.
3628

3729
## Modules
3830

@@ -41,13 +33,11 @@ Note that this example may create resources which cost money. Run `terraform des
4133
| <a name="module_tgw"></a> [tgw](#module\_tgw) | ../../ | n/a |
4234
| <a name="module_tgw_peer"></a> [tgw\_peer](#module\_tgw\_peer) | ../../ | n/a |
4335
| <a name="module_vpc1"></a> [vpc1](#module\_vpc1) | terraform-aws-modules/vpc/aws | ~> 3.0 |
36+
| <a name="module_vpc2"></a> [vpc2](#module\_vpc2) | terraform-aws-modules/vpc/aws | ~> 3.0 |
4437

4538
## Resources
4639

47-
| Name | Type |
48-
|------|------|
49-
| [aws_subnet_ids.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source |
50-
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
40+
No resources.
5141

5242
## Inputs
5343

0 commit comments

Comments
 (0)