Skip to content

Commit

Permalink
Finally, Terraform 0.12 support (terraform-aws-modules#266)
Browse files Browse the repository at this point in the history
* run terraform 0.12upgrade

* Cleanup for Terraform 0.12 (closes terraform-aws-modules#265, terraform-aws-modules#228)
  • Loading branch information
antonbabenko authored May 24, 2019
1 parent b0eea32 commit 8b423bf
Show file tree
Hide file tree
Showing 26 changed files with 1,239 additions and 561 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: v1.11.0
hooks:
- id: terraform_fmt
- id: terraform_docs
# - id: terraform_docs # not yet compatible with Terraform 0.12
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
Expand Down
23 changes: 12 additions & 11 deletions examples/complete-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ provider "aws" {

data "aws_security_group" "default" {
name = "default"
vpc_id = "${module.vpc.vpc_id}"
vpc_id = module.vpc.vpc_id
}

module "vpc" {
Expand Down Expand Up @@ -45,56 +45,57 @@ module "vpc" {
# VPC endpoint for SSM
enable_ssm_endpoint = true
ssm_endpoint_private_dns_enabled = true
ssm_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ssm_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC endpoint for SSMMESSAGES
enable_ssmmessages_endpoint = true
ssmmessages_endpoint_private_dns_enabled = true
ssmmessages_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ssmmessages_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC Endpoint for EC2
enable_ec2_endpoint = true
ec2_endpoint_private_dns_enabled = true
ec2_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ec2_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC Endpoint for EC2MESSAGES
enable_ec2messages_endpoint = true
ec2messages_endpoint_private_dns_enabled = true
ec2messages_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ec2messages_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC Endpoint for ECR API
enable_ecr_api_endpoint = true
ecr_api_endpoint_private_dns_enabled = true
ecr_api_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ecr_api_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC Endpoint for ECR DKR
enable_ecr_dkr_endpoint = true
ecr_dkr_endpoint_private_dns_enabled = true
ecr_dkr_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ecr_dkr_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC endpoint for KMS
enable_kms_endpoint = true
kms_endpoint_private_dns_enabled = true
kms_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
kms_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC endpoint for ECS
enable_ecs_endpoint = true
ecs_endpoint_private_dns_enabled = true
ecs_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ecs_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC endpoint for ECS telemetry
enable_ecs_telemetry_endpoint = true
ecs_telemetry_endpoint_private_dns_enabled = true
ecs_telemetry_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
ecs_telemetry_endpoint_security_group_ids = [data.aws_security_group.default.id]

# VPC endpoint for SQS
enable_sqs_endpoint = true
sqs_endpoint_private_dns_enabled = true
sqs_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
sqs_endpoint_security_group_ids = [data.aws_security_group.default.id]

tags = {
Owner = "user"
Environment = "staging"
Name = "complete"
}
}

23 changes: 11 additions & 12 deletions examples/complete-vpc/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}

# Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"]
value = module.vpc.private_subnets
}

output "public_subnets" {
description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"]
value = module.vpc.public_subnets
}

output "database_subnets" {
description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"]
value = module.vpc.database_subnets
}

output "elasticache_subnets" {
description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"]
value = module.vpc.elasticache_subnets
}

output "redshift_subnets" {
description = "List of IDs of redshift subnets"
value = ["${module.vpc.redshift_subnets}"]
value = module.vpc.redshift_subnets
}

output "intra_subnets" {
description = "List of IDs of intra subnets"
value = ["${module.vpc.intra_subnets}"]
value = module.vpc.intra_subnets
}

# NAT gateways
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = ["${module.vpc.nat_public_ips}"]
value = module.vpc.nat_public_ips
}

# VPC endpoints
output "vpc_endpoint_ssm_id" {
description = "The ID of VPC endpoint for SSM"
value = "${module.vpc.vpc_endpoint_ssm_id}"
value = module.vpc.vpc_endpoint_ssm_id
}

output "vpc_endpoint_ssm_network_interface_ids" {
description = "One or more network interfaces for the VPC Endpoint for SSM."
value = ["${module.vpc.vpc_endpoint_ssm_network_interface_ids}"]
value = module.vpc.vpc_endpoint_ssm_network_interface_ids
}

output "vpc_endpoint_ssm_dns_entry" {
description = "The DNS entries for the VPC Endpoint for SSM."
value = ["${module.vpc.vpc_endpoint_ssm_dns_entry}"]
value = module.vpc.vpc_endpoint_ssm_dns_entry
}

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

1 change: 1 addition & 0 deletions examples/issue-108-route-already-exists/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ module "vpc" {
enable_s3_endpoint = true
enable_dynamodb_endpoint = true
}

13 changes: 7 additions & 6 deletions examples/issue-108-route-already-exists/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}

# Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"]
value = module.vpc.private_subnets
}

output "public_subnets" {
description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"]
value = module.vpc.public_subnets
}

output "database_subnets" {
description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"]
value = module.vpc.database_subnets
}

output "elasticache_subnets" {
description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"]
value = module.vpc.elasticache_subnets
}

# NAT gateways
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = ["${module.vpc.nat_public_ips}"]
value = module.vpc.nat_public_ips
}

5 changes: 3 additions & 2 deletions examples/issue-224-vpcendpoint-apigw/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ provider "aws" {

data "aws_security_group" "default" {
name = "default"
vpc_id = "${module.vpc.vpc_id}"
vpc_id = module.vpc.vpc_id
}

module "vpc" {
Expand All @@ -19,7 +19,7 @@ module "vpc" {

# VPC endpoint for API gateway
enable_apigw_endpoint = true
apigw_endpoint_security_group_ids = ["${data.aws_security_group.default.id}"]
apigw_endpoint_security_group_ids = [data.aws_security_group.default.id]
apigw_endpoint_private_dns_enabled = true

tags = {
Expand All @@ -28,3 +28,4 @@ module "vpc" {
Name = "test-224"
}
}

1 change: 1 addition & 0 deletions examples/issue-44-asymmetric-private-subnets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ module "vpc" {
Name = "asymmetrical"
}
}

13 changes: 7 additions & 6 deletions examples/issue-44-asymmetric-private-subnets/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}

# Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"]
value = module.vpc.private_subnets
}

output "public_subnets" {
description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"]
value = module.vpc.public_subnets
}

output "database_subnets" {
description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"]
value = module.vpc.database_subnets
}

output "elasticache_subnets" {
description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"]
value = module.vpc.elasticache_subnets
}

# NAT gateways
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = ["${module.vpc.nat_public_ips}"]
value = module.vpc.nat_public_ips
}

1 change: 1 addition & 0 deletions examples/issue-46-no-private-subnets/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ module "vpc" {
Name = "no-private-subnets"
}
}

13 changes: 7 additions & 6 deletions examples/issue-46-no-private-subnets/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}

# Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"]
value = module.vpc.private_subnets
}

output "public_subnets" {
description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"]
value = module.vpc.public_subnets
}

output "database_subnets" {
description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"]
value = module.vpc.database_subnets
}

output "elasticache_subnets" {
description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"]
value = module.vpc.elasticache_subnets
}

# NAT gateways
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = ["${module.vpc.nat_public_ips}"]
value = module.vpc.nat_public_ips
}

1 change: 1 addition & 0 deletions examples/manage-default-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ module "vpc" {
default_vpc_name = "default"
default_vpc_enable_dns_hostnames = true
}

5 changes: 3 additions & 2 deletions examples/manage-default-vpc/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Default VPC
output "default_vpc_id" {
description = "The ID of the Default VPC"
value = "${module.vpc.default_vpc_id}"
value = module.vpc.default_vpc_id
}

output "default_vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = "${module.vpc.default_vpc_cidr_block}"
value = module.vpc.default_vpc_cidr_block
}

14 changes: 9 additions & 5 deletions examples/network-acls/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ module "vpc" {
elasticache_subnets = ["10.0.201.0/24", "10.0.202.0/24", "10.0.203.0/24"]

public_dedicated_network_acl = true
public_inbound_acl_rules = "${concat(local.network_acls["default_inbound"], local.network_acls["public_inbound"])}"
public_outbound_acl_rules = "${concat(local.network_acls["default_outbound"], local.network_acls["public_outbound"])}"
public_inbound_acl_rules = concat(
local.network_acls["default_inbound"],
local.network_acls["public_inbound"],
)
public_outbound_acl_rules = concat(
local.network_acls["default_outbound"],
local.network_acls["public_outbound"],
)

private_dedicated_network_acl = true

Expand Down Expand Up @@ -51,7 +57,6 @@ locals {
cidr_block = "0.0.0.0/0"
},
]

default_outbound = [
{
rule_number = 900
Expand All @@ -62,7 +67,6 @@ locals {
cidr_block = "0.0.0.0/0"
},
]

public_inbound = [
{
rule_number = 100
Expand Down Expand Up @@ -97,7 +101,6 @@ locals {
cidr_block = "0.0.0.0/0"
},
]

public_outbound = [
{
rule_number = 100
Expand Down Expand Up @@ -134,3 +137,4 @@ locals {
]
}
}

Loading

0 comments on commit 8b423bf

Please sign in to comment.