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: ...@@ -3,7 +3,7 @@ repos:
rev: v1.11.0 rev: v1.11.0
hooks: hooks:
- id: terraform_fmt - 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 - repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3 rev: v2.2.3
hooks: hooks:
......
...@@ -4,7 +4,7 @@ provider "aws" { ...@@ -4,7 +4,7 @@ provider "aws" {
data "aws_security_group" "default" { data "aws_security_group" "default" {
name = "default" name = "default"
vpc_id = "${module.vpc.vpc_id}" vpc_id = module.vpc.vpc_id
} }
module "vpc" { module "vpc" {
...@@ -45,52 +45,52 @@ module "vpc" { ...@@ -45,52 +45,52 @@ module "vpc" {
# VPC endpoint for SSM # VPC endpoint for SSM
enable_ssm_endpoint = true enable_ssm_endpoint = true
ssm_endpoint_private_dns_enabled = 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 # VPC endpoint for SSMMESSAGES
enable_ssmmessages_endpoint = true enable_ssmmessages_endpoint = true
ssmmessages_endpoint_private_dns_enabled = 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 # VPC Endpoint for EC2
enable_ec2_endpoint = true enable_ec2_endpoint = true
ec2_endpoint_private_dns_enabled = 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 # VPC Endpoint for EC2MESSAGES
enable_ec2messages_endpoint = true enable_ec2messages_endpoint = true
ec2messages_endpoint_private_dns_enabled = 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 # VPC Endpoint for ECR API
enable_ecr_api_endpoint = true enable_ecr_api_endpoint = true
ecr_api_endpoint_private_dns_enabled = 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 # VPC Endpoint for ECR DKR
enable_ecr_dkr_endpoint = true enable_ecr_dkr_endpoint = true
ecr_dkr_endpoint_private_dns_enabled = 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 # VPC endpoint for KMS
enable_kms_endpoint = true enable_kms_endpoint = true
kms_endpoint_private_dns_enabled = 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 # VPC endpoint for ECS
enable_ecs_endpoint = true enable_ecs_endpoint = true
ecs_endpoint_private_dns_enabled = 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 # VPC endpoint for ECS telemetry
enable_ecs_telemetry_endpoint = true enable_ecs_telemetry_endpoint = true
ecs_telemetry_endpoint_private_dns_enabled = 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 # VPC endpoint for SQS
enable_sqs_endpoint = true enable_sqs_endpoint = true
sqs_endpoint_private_dns_enabled = 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 = { tags = {
Owner = "user" Owner = "user"
...@@ -98,3 +98,4 @@ module "vpc" { ...@@ -98,3 +98,4 @@ module "vpc" {
Name = "complete" Name = "complete"
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
output "database_subnets" { output "database_subnets" {
description = "List of IDs of database subnets" description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"] value = module.vpc.database_subnets
} }
output "elasticache_subnets" { output "elasticache_subnets" {
description = "List of IDs of elasticache subnets" description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"] value = module.vpc.elasticache_subnets
} }
output "redshift_subnets" { output "redshift_subnets" {
description = "List of IDs of redshift subnets" description = "List of IDs of redshift subnets"
value = ["${module.vpc.redshift_subnets}"] value = module.vpc.redshift_subnets
} }
output "intra_subnets" { output "intra_subnets" {
description = "List of IDs of intra subnets" description = "List of IDs of intra subnets"
value = ["${module.vpc.intra_subnets}"] value = module.vpc.intra_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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 # VPC endpoints
output "vpc_endpoint_ssm_id" { output "vpc_endpoint_ssm_id" {
description = "The ID of VPC endpoint for SSM" 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" { output "vpc_endpoint_ssm_network_interface_ids" {
description = "One or more network interfaces for the VPC Endpoint for SSM." 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" { output "vpc_endpoint_ssm_dns_entry" {
description = "The DNS entries for the VPC Endpoint for SSM." 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" { ...@@ -73,4 +73,3 @@ output "vpc_endpoint_ssm_dns_entry" {
// description = "The DNS entries for the VPC Endpoint for EC2." // description = "The DNS entries for the VPC Endpoint for EC2."
// value = ["${module.vpc.vpc_endpoint_ec2_dns_entry}"] // value = ["${module.vpc.vpc_endpoint_ec2_dns_entry}"]
//} //}
...@@ -19,3 +19,4 @@ module "vpc" { ...@@ -19,3 +19,4 @@ module "vpc" {
enable_s3_endpoint = true enable_s3_endpoint = true
enable_dynamodb_endpoint = true enable_dynamodb_endpoint = true
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
output "database_subnets" { output "database_subnets" {
description = "List of IDs of database subnets" description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"] value = module.vpc.database_subnets
} }
output "elasticache_subnets" { output "elasticache_subnets" {
description = "List of IDs of elasticache subnets" description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"] value = module.vpc.elasticache_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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" { ...@@ -4,7 +4,7 @@ provider "aws" {
data "aws_security_group" "default" { data "aws_security_group" "default" {
name = "default" name = "default"
vpc_id = "${module.vpc.vpc_id}" vpc_id = module.vpc.vpc_id
} }
module "vpc" { module "vpc" {
...@@ -19,7 +19,7 @@ module "vpc" { ...@@ -19,7 +19,7 @@ module "vpc" {
# VPC endpoint for API gateway # VPC endpoint for API gateway
enable_apigw_endpoint = true 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 apigw_endpoint_private_dns_enabled = true
tags = { tags = {
...@@ -28,3 +28,4 @@ module "vpc" { ...@@ -28,3 +28,4 @@ module "vpc" {
Name = "test-224" Name = "test-224"
} }
} }
...@@ -25,3 +25,4 @@ module "vpc" { ...@@ -25,3 +25,4 @@ module "vpc" {
Name = "asymmetrical" Name = "asymmetrical"
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
output "database_subnets" { output "database_subnets" {
description = "List of IDs of database subnets" description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"] value = module.vpc.database_subnets
} }
output "elasticache_subnets" { output "elasticache_subnets" {
description = "List of IDs of elasticache subnets" description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"] value = module.vpc.elasticache_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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" { ...@@ -23,3 +23,4 @@ module "vpc" {
Name = "no-private-subnets" Name = "no-private-subnets"
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
output "database_subnets" { output "database_subnets" {
description = "List of IDs of database subnets" description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"] value = module.vpc.database_subnets
} }
output "elasticache_subnets" { output "elasticache_subnets" {
description = "List of IDs of elasticache subnets" description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"] value = module.vpc.elasticache_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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" { ...@@ -11,3 +11,4 @@ module "vpc" {
default_vpc_name = "default" default_vpc_name = "default"
default_vpc_enable_dns_hostnames = true default_vpc_enable_dns_hostnames = true
} }
# Default VPC # Default VPC
output "default_vpc_id" { output "default_vpc_id" {
description = "The ID of the Default VPC" description = "The ID of the Default VPC"
value = "${module.vpc.default_vpc_id}" value = module.vpc.default_vpc_id
} }
output "default_vpc_cidr_block" { output "default_vpc_cidr_block" {
description = "The CIDR block of the VPC" 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" { ...@@ -15,8 +15,14 @@ module "vpc" {
elasticache_subnets = ["10.0.201.0/24", "10.0.202.0/24", "10.0.203.0/24"] elasticache_subnets = ["10.0.201.0/24", "10.0.202.0/24", "10.0.203.0/24"]
public_dedicated_network_acl = true public_dedicated_network_acl = true
public_inbound_acl_rules = "${concat(local.network_acls["default_inbound"], local.network_acls["public_inbound"])}" public_inbound_acl_rules = concat(
public_outbound_acl_rules = "${concat(local.network_acls["default_outbound"], local.network_acls["public_outbound"])}" 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 private_dedicated_network_acl = true
...@@ -51,7 +57,6 @@ locals { ...@@ -51,7 +57,6 @@ locals {
cidr_block = "0.0.0.0/0" cidr_block = "0.0.0.0/0"
}, },
] ]
default_outbound = [ default_outbound = [
{ {
rule_number = 900 rule_number = 900
...@@ -62,7 +67,6 @@ locals { ...@@ -62,7 +67,6 @@ locals {
cidr_block = "0.0.0.0/0" cidr_block = "0.0.0.0/0"
}, },
] ]
public_inbound = [ public_inbound = [
{ {
rule_number = 100 rule_number = 100
...@@ -97,7 +101,6 @@ locals { ...@@ -97,7 +101,6 @@ locals {
cidr_block = "0.0.0.0/0" cidr_block = "0.0.0.0/0"
}, },
] ]
public_outbound = [ public_outbound = [
{ {
rule_number = 100 rule_number = 100
...@@ -134,3 +137,4 @@ locals { ...@@ -134,3 +137,4 @@ locals {
] ]
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# CIDR blocks # CIDR blocks
output "vpc_cidr_block" { output "vpc_cidr_block" {
description = "The CIDR block of the VPC" description = "The CIDR block of the VPC"
value = ["${module.vpc.vpc_cidr_block}"] value = module.vpc.vpc_cidr_block
} }
//output "vpc_ipv6_cidr_block" { //output "vpc_ipv6_cidr_block" {
...@@ -18,37 +18,38 @@ output "vpc_cidr_block" { ...@@ -18,37 +18,38 @@ output "vpc_cidr_block" {
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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 # Network ACLs
output "public_network_acl_id" { output "public_network_acl_id" {
description = "ID of the public network ACL" 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" { output "private_network_acl_id" {
description = "ID of the private network ACL" 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" { output "elasticache_network_acl_id" {
description = "ID of the elasticache network ACL" 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" { output "default_network_acl_id" {
description = "The ID of the default network ACL" 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" { ...@@ -31,3 +31,4 @@ module "vpc" {
Name = "vpc-name" Name = "vpc-name"
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# CIDR blocks # CIDR blocks
output "vpc_cidr_block" { output "vpc_cidr_block" {
description = "The CIDR block of the VPC" description = "The CIDR block of the VPC"
value = ["${module.vpc.vpc_cidr_block}"] value = module.vpc.vpc_cidr_block
} }
output "vpc_secondary_cidr_blocks" { output "vpc_secondary_cidr_blocks" {
description = "List of secondary CIDR blocks of the VPC" description = "List of secondary CIDR blocks of the VPC"
value = ["${module.vpc.vpc_secondary_cidr_blocks}"] value = module.vpc.vpc_secondary_cidr_blocks
} }
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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" { ...@@ -4,7 +4,7 @@ provider "aws" {
data "aws_security_group" "default" { data "aws_security_group" "default" {
name = "default" name = "default"
vpc_id = "${module.vpc.vpc_id}" vpc_id = module.vpc.vpc_id
} }
module "vpc" { module "vpc" {
...@@ -36,3 +36,4 @@ module "vpc" { ...@@ -36,3 +36,4 @@ module "vpc" {
Name = "vpc-name" Name = "vpc-name"
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# CIDR blocks # CIDR blocks
output "vpc_cidr_block" { output "vpc_cidr_block" {
description = "The CIDR block of the VPC" description = "The CIDR block of the VPC"
value = ["${module.vpc.vpc_cidr_block}"] value = module.vpc.vpc_cidr_block
} }
//output "vpc_ipv6_cidr_block" { //output "vpc_ipv6_cidr_block" {
...@@ -18,22 +18,23 @@ output "vpc_cidr_block" { ...@@ -18,22 +18,23 @@ output "vpc_cidr_block" {
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" description = "List of public Elastic IPs created for AWS NAT Gateway"
value = ["${module.vpc.nat_public_ips}"] value = module.vpc.nat_public_ips
} }
# AZs # AZs
output "azs" { output "azs" {
description = "A list of availability zones spefified as argument to this module" description = "A list of availability zones spefified as argument to this module"
value = ["${module.vpc.azs}"] value = module.vpc.azs
} }
provider "aws" { provider "aws" {
region = "${var.region}" region = var.region
} }
data "aws_availability_zones" "available" {} data "aws_availability_zones" "available" {
}
module "vpc" { module "vpc" {
source = "../.." source = "../.."
name = "test-example" name = "test-example"
cidr = "10.0.0.0/16" 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"] private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
enable_nat_gateway = true enable_nat_gateway = true
...@@ -19,3 +20,4 @@ module "vpc" { ...@@ -19,3 +20,4 @@ module "vpc" {
Environment = "dev" Environment = "dev"
} }
} }
output "region" { output "region" {
description = "Region we created the resources in." description = "Region we created the resources in."
value = "${var.region}" value = var.region
} }
variable "region" { variable "region" {
default = "eu-west-1" default = "eu-west-1"
} }
...@@ -29,3 +29,4 @@ module "vpc" { ...@@ -29,3 +29,4 @@ module "vpc" {
Name = "separate-private-route-tables" Name = "separate-private-route-tables"
} }
} }
# VPC # VPC
output "vpc_id" { output "vpc_id" {
description = "The ID of the VPC" description = "The ID of the VPC"
value = "${module.vpc.vpc_id}" value = module.vpc.vpc_id
} }
# Subnets # Subnets
output "private_subnets" { output "private_subnets" {
description = "List of IDs of private subnets" description = "List of IDs of private subnets"
value = ["${module.vpc.private_subnets}"] value = module.vpc.private_subnets
} }
output "public_subnets" { output "public_subnets" {
description = "List of IDs of public subnets" description = "List of IDs of public subnets"
value = ["${module.vpc.public_subnets}"] value = module.vpc.public_subnets
} }
output "database_subnets" { output "database_subnets" {
description = "List of IDs of database subnets" description = "List of IDs of database subnets"
value = ["${module.vpc.database_subnets}"] value = module.vpc.database_subnets
} }
output "elasticache_subnets" { output "elasticache_subnets" {
description = "List of IDs of elasticache subnets" description = "List of IDs of elasticache subnets"
value = ["${module.vpc.elasticache_subnets}"] value = module.vpc.elasticache_subnets
} }
output "redshift_subnets" { output "redshift_subnets" {
description = "List of IDs of elasticache subnets" description = "List of IDs of elasticache subnets"
value = ["${module.vpc.redshift_subnets}"] value = module.vpc.redshift_subnets
} }
# NAT gateways # NAT gateways
output "nat_public_ips" { output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway" 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