Commit 4ae98060 authored by Anton Babenko's avatar Anton Babenko Committed by GitHub

Finally, Terraform 0.12 support (#266)

* run terraform 0.12upgrade

* Cleanup for Terraform 0.12 (closes #265, #228)
parent 3d33b1fc
......@@ -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:
......
......@@ -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" {
......@@ -45,52 +45,52 @@ 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"
......@@ -98,3 +98,4 @@ module "vpc" {
Name = "complete"
}
}
# 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
}
//
......@@ -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}"]
//}
......@@ -19,3 +19,4 @@ module "vpc" {
enable_s3_endpoint = true
enable_dynamodb_endpoint = true
}
# 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
}
......@@ -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" {
......@@ -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 = {
......@@ -28,3 +28,4 @@ module "vpc" {
Name = "test-224"
}
}
......@@ -25,3 +25,4 @@ module "vpc" {
Name = "asymmetrical"
}
}
# 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
}
......@@ -23,3 +23,4 @@ module "vpc" {
Name = "no-private-subnets"
}
}
# 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
}
......@@ -11,3 +11,4 @@ module "vpc" {
default_vpc_name = "default"
default_vpc_enable_dns_hostnames = true
}
# 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
}
......@@ -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
......@@ -51,7 +57,6 @@ locals {
cidr_block = "0.0.0.0/0"
},
]
default_outbound = [
{
rule_number = 900
......@@ -62,7 +67,6 @@ locals {
cidr_block = "0.0.0.0/0"
},
]
public_inbound = [
{
rule_number = 100
......@@ -97,7 +101,6 @@ locals {
cidr_block = "0.0.0.0/0"
},
]
public_outbound = [
{
rule_number = 100
......@@ -134,3 +137,4 @@ locals {
]
}
}
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}
# CIDR blocks
output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = ["${module.vpc.vpc_cidr_block}"]
value = module.vpc.vpc_cidr_block
}
//output "vpc_ipv6_cidr_block" {
......@@ -18,37 +18,38 @@ output "vpc_cidr_block" {
# 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
}
# 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
}
# Network ACLs
output "public_network_acl_id" {
description = "ID of the public network ACL"
value = "${module.vpc.public_network_acl_id}"
value = module.vpc.public_network_acl_id
}
output "private_network_acl_id" {
description = "ID of the private network ACL"
value = "${module.vpc.private_network_acl_id}"
value = module.vpc.private_network_acl_id
}
output "elasticache_network_acl_id" {
description = "ID of the elasticache network ACL"
value = "${module.vpc.elasticache_network_acl_id}"
value = module.vpc.elasticache_network_acl_id
}
output "default_network_acl_id" {
description = "The ID of the default network ACL"
value = "${module.vpc.default_network_acl_id}"
value = module.vpc.default_network_acl_id
}
......@@ -31,3 +31,4 @@ module "vpc" {
Name = "vpc-name"
}
}
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}
# CIDR blocks
output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = ["${module.vpc.vpc_cidr_block}"]
value = module.vpc.vpc_cidr_block
}
output "vpc_secondary_cidr_blocks" {
description = "List of secondary CIDR blocks of the VPC"
value = ["${module.vpc.vpc_secondary_cidr_blocks}"]
value = module.vpc.vpc_secondary_cidr_blocks
}
# 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
}
# 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
}
......@@ -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" {
......@@ -36,3 +36,4 @@ module "vpc" {
Name = "vpc-name"
}
}
# VPC
output "vpc_id" {
description = "The ID of the VPC"
value = "${module.vpc.vpc_id}"
value = module.vpc.vpc_id
}
# CIDR blocks
output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = ["${module.vpc.vpc_cidr_block}"]
value = module.vpc.vpc_cidr_block
}
//output "vpc_ipv6_cidr_block" {
......@@ -18,22 +18,23 @@ output "vpc_cidr_block" {
# 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
}
# 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
}
# AZs
output "azs" {
description = "A list of availability zones spefified as argument to this module"
value = ["${module.vpc.azs}"]
value = module.vpc.azs
}
provider "aws" {
region = "${var.region}"
region = var.region
}
data "aws_availability_zones" "available" {}
data "aws_availability_zones" "available" {
}
module "vpc" {
source = "../.."
name = "test-example"
cidr = "10.0.0.0/16"
azs = ["${data.aws_availability_zones.available.names[0]}", "${data.aws_availability_zones.available.names[1]}"]
azs = [data.aws_availability_zones.available.names[0], data.aws_availability_zones.available.names[1]]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
enable_nat_gateway = true
......@@ -19,3 +20,4 @@ module "vpc" {
Environment = "dev"
}
}
output "region" {
description = "Region we created the resources in."
value = "${var.region}"
value = var.region
}
variable "region" {
default = "eu-west-1"
}
......@@ -29,3 +29,4 @@ module "vpc" {
Name = "separate-private-route-tables"
}
}
# 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 elasticache subnets"
value = ["${module.vpc.redshift_subnets}"]
value = module.vpc.redshift_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
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment