Skip to content

Commit 4ae9806

Browse files
authored
Finally, Terraform 0.12 support (#266)
* run terraform 0.12upgrade * Cleanup for Terraform 0.12 (closes #265, #228)
1 parent 3d33b1f commit 4ae9806

File tree

26 files changed

+1239
-561
lines changed

26 files changed

+1239
-561
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
rev: v1.11.0
44
hooks:
55
- id: terraform_fmt
6-
- id: terraform_docs
6+
# - id: terraform_docs # not yet compatible with Terraform 0.12
77
- repo: git://github.com/pre-commit/pre-commit-hooks
88
rev: v2.2.3
99
hooks:

examples/complete-vpc/main.tf

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ provider "aws" {
44

55
data "aws_security_group" "default" {
66
name = "default"
7-
vpc_id = "${module.vpc.vpc_id}"
7+
vpc_id = module.vpc.vpc_id
88
}
99

1010
module "vpc" {
@@ -45,56 +45,57 @@ module "vpc" {
4545
# VPC endpoint for SSM
4646
enable_ssm_endpoint = true
4747
ssm_endpoint_private_dns_enabled = true
48-
ssm_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
48+
ssm_endpoint_security_group_ids = [data.aws_security_group.default.id]
4949

5050
# VPC endpoint for SSMMESSAGES
5151
enable_ssmmessages_endpoint = true
5252
ssmmessages_endpoint_private_dns_enabled = true
53-
ssmmessages_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
53+
ssmmessages_endpoint_security_group_ids = [data.aws_security_group.default.id]
5454

5555
# VPC Endpoint for EC2
5656
enable_ec2_endpoint = true
5757
ec2_endpoint_private_dns_enabled = true
58-
ec2_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
58+
ec2_endpoint_security_group_ids = [data.aws_security_group.default.id]
5959

6060
# VPC Endpoint for EC2MESSAGES
6161
enable_ec2messages_endpoint = true
6262
ec2messages_endpoint_private_dns_enabled = true
63-
ec2messages_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
63+
ec2messages_endpoint_security_group_ids = [data.aws_security_group.default.id]
6464

6565
# VPC Endpoint for ECR API
6666
enable_ecr_api_endpoint = true
6767
ecr_api_endpoint_private_dns_enabled = true
68-
ecr_api_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
68+
ecr_api_endpoint_security_group_ids = [data.aws_security_group.default.id]
6969

7070
# VPC Endpoint for ECR DKR
7171
enable_ecr_dkr_endpoint = true
7272
ecr_dkr_endpoint_private_dns_enabled = true
73-
ecr_dkr_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
73+
ecr_dkr_endpoint_security_group_ids = [data.aws_security_group.default.id]
7474

7575
# VPC endpoint for KMS
7676
enable_kms_endpoint = true
7777
kms_endpoint_private_dns_enabled = true
78-
kms_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
78+
kms_endpoint_security_group_ids = [data.aws_security_group.default.id]
7979

8080
# VPC endpoint for ECS
8181
enable_ecs_endpoint = true
8282
ecs_endpoint_private_dns_enabled = true
83-
ecs_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
83+
ecs_endpoint_security_group_ids = [data.aws_security_group.default.id]
8484

8585
# VPC endpoint for ECS telemetry
8686
enable_ecs_telemetry_endpoint = true
8787
ecs_telemetry_endpoint_private_dns_enabled = true
88-
ecs_telemetry_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
88+
ecs_telemetry_endpoint_security_group_ids = [data.aws_security_group.default.id]
8989

9090
# VPC endpoint for SQS
9191
enable_sqs_endpoint = true
9292
sqs_endpoint_private_dns_enabled = true
93-
sqs_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
93+
sqs_endpoint_security_group_ids = [data.aws_security_group.default.id]
9494

9595
tags = {
9696
Owner = "user"
9797
Environment = "staging"
9898
Name = "complete"
9999
}
100100
}
101+

examples/complete-vpc/outputs.tf

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
# VPC
22
output "vpc_id" {
33
description = "The ID of the VPC"
4-
value = "${module.vpc.vpc_id}"
4+
value = module.vpc.vpc_id
55
}
66

77
# Subnets
88
output "private_subnets" {
99
description = "List of IDs of private subnets"
10-
value = ["${module.vpc.private_subnets}"]
10+
value = module.vpc.private_subnets
1111
}
1212

1313
output "public_subnets" {
1414
description = "List of IDs of public subnets"
15-
value = ["${module.vpc.public_subnets}"]
15+
value = module.vpc.public_subnets
1616
}
1717

1818
output "database_subnets" {
1919
description = "List of IDs of database subnets"
20-
value = ["${module.vpc.database_subnets}"]
20+
value = module.vpc.database_subnets
2121
}
2222

2323
output "elasticache_subnets" {
2424
description = "List of IDs of elasticache subnets"
25-
value = ["${module.vpc.elasticache_subnets}"]
25+
value = module.vpc.elasticache_subnets
2626
}
2727

2828
output "redshift_subnets" {
2929
description = "List of IDs of redshift subnets"
30-
value = ["${module.vpc.redshift_subnets}"]
30+
value = module.vpc.redshift_subnets
3131
}
3232

3333
output "intra_subnets" {
3434
description = "List of IDs of intra subnets"
35-
value = ["${module.vpc.intra_subnets}"]
35+
value = module.vpc.intra_subnets
3636
}
3737

3838
# NAT gateways
3939
output "nat_public_ips" {
4040
description = "List of public Elastic IPs created for AWS NAT Gateway"
41-
value = ["${module.vpc.nat_public_ips}"]
41+
value = module.vpc.nat_public_ips
4242
}
4343

4444
# VPC endpoints
4545
output "vpc_endpoint_ssm_id" {
4646
description = "The ID of VPC endpoint for SSM"
47-
value = "${module.vpc.vpc_endpoint_ssm_id}"
47+
value = module.vpc.vpc_endpoint_ssm_id
4848
}
4949

5050
output "vpc_endpoint_ssm_network_interface_ids" {
5151
description = "One or more network interfaces for the VPC Endpoint for SSM."
52-
value = ["${module.vpc.vpc_endpoint_ssm_network_interface_ids}"]
52+
value = module.vpc.vpc_endpoint_ssm_network_interface_ids
5353
}
5454

5555
output "vpc_endpoint_ssm_dns_entry" {
5656
description = "The DNS entries for the VPC Endpoint for SSM."
57-
value = ["${module.vpc.vpc_endpoint_ssm_dns_entry}"]
57+
value = module.vpc.vpc_endpoint_ssm_dns_entry
5858
}
5959

6060
//
@@ -73,4 +73,3 @@ output "vpc_endpoint_ssm_dns_entry" {
7373
// description = "The DNS entries for the VPC Endpoint for EC2."
7474
// value = ["${module.vpc.vpc_endpoint_ec2_dns_entry}"]
7575
//}
76-

examples/issue-108-route-already-exists/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ module "vpc" {
1919
enable_s3_endpoint = true
2020
enable_dynamodb_endpoint = true
2121
}
22+
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
# VPC
22
output "vpc_id" {
33
description = "The ID of the VPC"
4-
value = "${module.vpc.vpc_id}"
4+
value = module.vpc.vpc_id
55
}
66

77
# Subnets
88
output "private_subnets" {
99
description = "List of IDs of private subnets"
10-
value = ["${module.vpc.private_subnets}"]
10+
value = module.vpc.private_subnets
1111
}
1212

1313
output "public_subnets" {
1414
description = "List of IDs of public subnets"
15-
value = ["${module.vpc.public_subnets}"]
15+
value = module.vpc.public_subnets
1616
}
1717

1818
output "database_subnets" {
1919
description = "List of IDs of database subnets"
20-
value = ["${module.vpc.database_subnets}"]
20+
value = module.vpc.database_subnets
2121
}
2222

2323
output "elasticache_subnets" {
2424
description = "List of IDs of elasticache subnets"
25-
value = ["${module.vpc.elasticache_subnets}"]
25+
value = module.vpc.elasticache_subnets
2626
}
2727

2828
# NAT gateways
2929
output "nat_public_ips" {
3030
description = "List of public Elastic IPs created for AWS NAT Gateway"
31-
value = ["${module.vpc.nat_public_ips}"]
31+
value = module.vpc.nat_public_ips
3232
}
33+

examples/issue-224-vpcendpoint-apigw/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ provider "aws" {
44

55
data "aws_security_group" "default" {
66
name = "default"
7-
vpc_id = "${module.vpc.vpc_id}"
7+
vpc_id = module.vpc.vpc_id
88
}
99

1010
module "vpc" {
@@ -19,7 +19,7 @@ module "vpc" {
1919

2020
# VPC endpoint for API gateway
2121
enable_apigw_endpoint = true
22-
apigw_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
22+
apigw_endpoint_security_group_ids = [data.aws_security_group.default.id]
2323
apigw_endpoint_private_dns_enabled = true
2424

2525
tags = {
@@ -28,3 +28,4 @@ module "vpc" {
2828
Name = "test-224"
2929
}
3030
}
31+

examples/issue-44-asymmetric-private-subnets/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ module "vpc" {
2525
Name = "asymmetrical"
2626
}
2727
}
28+
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
# VPC
22
output "vpc_id" {
33
description = "The ID of the VPC"
4-
value = "${module.vpc.vpc_id}"
4+
value = module.vpc.vpc_id
55
}
66

77
# Subnets
88
output "private_subnets" {
99
description = "List of IDs of private subnets"
10-
value = ["${module.vpc.private_subnets}"]
10+
value = module.vpc.private_subnets
1111
}
1212

1313
output "public_subnets" {
1414
description = "List of IDs of public subnets"
15-
value = ["${module.vpc.public_subnets}"]
15+
value = module.vpc.public_subnets
1616
}
1717

1818
output "database_subnets" {
1919
description = "List of IDs of database subnets"
20-
value = ["${module.vpc.database_subnets}"]
20+
value = module.vpc.database_subnets
2121
}
2222

2323
output "elasticache_subnets" {
2424
description = "List of IDs of elasticache subnets"
25-
value = ["${module.vpc.elasticache_subnets}"]
25+
value = module.vpc.elasticache_subnets
2626
}
2727

2828
# NAT gateways
2929
output "nat_public_ips" {
3030
description = "List of public Elastic IPs created for AWS NAT Gateway"
31-
value = ["${module.vpc.nat_public_ips}"]
31+
value = module.vpc.nat_public_ips
3232
}
33+

examples/issue-46-no-private-subnets/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ module "vpc" {
2323
Name = "no-private-subnets"
2424
}
2525
}
26+
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
# VPC
22
output "vpc_id" {
33
description = "The ID of the VPC"
4-
value = "${module.vpc.vpc_id}"
4+
value = module.vpc.vpc_id
55
}
66

77
# Subnets
88
output "private_subnets" {
99
description = "List of IDs of private subnets"
10-
value = ["${module.vpc.private_subnets}"]
10+
value = module.vpc.private_subnets
1111
}
1212

1313
output "public_subnets" {
1414
description = "List of IDs of public subnets"
15-
value = ["${module.vpc.public_subnets}"]
15+
value = module.vpc.public_subnets
1616
}
1717

1818
output "database_subnets" {
1919
description = "List of IDs of database subnets"
20-
value = ["${module.vpc.database_subnets}"]
20+
value = module.vpc.database_subnets
2121
}
2222

2323
output "elasticache_subnets" {
2424
description = "List of IDs of elasticache subnets"
25-
value = ["${module.vpc.elasticache_subnets}"]
25+
value = module.vpc.elasticache_subnets
2626
}
2727

2828
# NAT gateways
2929
output "nat_public_ips" {
3030
description = "List of public Elastic IPs created for AWS NAT Gateway"
31-
value = ["${module.vpc.nat_public_ips}"]
31+
value = module.vpc.nat_public_ips
3232
}
33+

examples/manage-default-vpc/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ module "vpc" {
1111
default_vpc_name = "default"
1212
default_vpc_enable_dns_hostnames = true
1313
}
14+
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Default VPC
22
output "default_vpc_id" {
33
description = "The ID of the Default VPC"
4-
value = "${module.vpc.default_vpc_id}"
4+
value = module.vpc.default_vpc_id
55
}
66

77
output "default_vpc_cidr_block" {
88
description = "The CIDR block of the VPC"
9-
value = "${module.vpc.default_vpc_cidr_block}"
9+
value = module.vpc.default_vpc_cidr_block
1010
}
11+

examples/network-acls/main.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ module "vpc" {
1515
elasticache_subnets = ["10.0.201.0/24", "10.0.202.0/24", "10.0.203.0/24"]
1616

1717
public_dedicated_network_acl = true
18-
public_inbound_acl_rules = "${concat(local.network_acls["default_inbound"], local.network_acls["public_inbound"])}"
19-
public_outbound_acl_rules = "${concat(local.network_acls["default_outbound"], local.network_acls["public_outbound"])}"
18+
public_inbound_acl_rules = concat(
19+
local.network_acls["default_inbound"],
20+
local.network_acls["public_inbound"],
21+
)
22+
public_outbound_acl_rules = concat(
23+
local.network_acls["default_outbound"],
24+
local.network_acls["public_outbound"],
25+
)
2026

2127
private_dedicated_network_acl = true
2228

@@ -51,7 +57,6 @@ locals {
5157
cidr_block = "0.0.0.0/0"
5258
},
5359
]
54-
5560
default_outbound = [
5661
{
5762
rule_number = 900
@@ -62,7 +67,6 @@ locals {
6267
cidr_block = "0.0.0.0/0"
6368
},
6469
]
65-
6670
public_inbound = [
6771
{
6872
rule_number = 100
@@ -97,7 +101,6 @@ locals {
97101
cidr_block = "0.0.0.0/0"
98102
},
99103
]
100-
101104
public_outbound = [
102105
{
103106
rule_number = 100
@@ -134,3 +137,4 @@ locals {
134137
]
135138
}
136139
}
140+

0 commit comments

Comments
 (0)