Skip to content

Instantly share code, notes, and snippets.

@krystan
Created September 15, 2020 22:37
Show Gist options
  • Save krystan/d2dbbd2e4938cc5a14587664e7d3923c to your computer and use it in GitHub Desktop.
Save krystan/d2dbbd2e4938cc5a14587664e7d3923c to your computer and use it in GitHub Desktop.
region = "eu-west-2"
availability_zones = ["eu-west-2a", "eu-west-2b", "eu-west-2c"]
namespace = "eg"
stage = "test"
name = "subnets-vpc-test"
existing_nat_ips = ["18.133.71.173", "35.177.115.101", "35.177.223.95"]
provider "aws" {
region = var.region
}
module "vpc" {
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1"
namespace = var.namespace
stage = var.stage
name = var.name
cidr_block = "10.16.0.0/16"
}
module "subnets" {
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=0.30.0"
availability_zones = var.availability_zones
namespace = var.namespace
stage = var.stage
name = var.name
vpc_id = module.vpc.vpc_id
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
existing_nat_ips = var.existing_nat_ips
nat_instance_type = "t2.micro"
nat_gateway_enabled = false
nat_instance_enabled = true
}
variable "region" {
type = string
description = "AWS region"
}
variable "availability_zones" {
type = list(string)
description = "List of Availability Zones where subnets will be created"
}
variable "namespace" {
type = string
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
}
variable "stage" {
type = string
description = "Stage, e.g. 'prod', 'staging', 'dev', or 'test'"
}
variable "name" {
type = string
description = "Solution/application name, e.g. 'app' or 'cluster'"
}
variable "existing_nat_ips" {
type = list(string)
default = []
description = "Existing Elastic IPs to attach to the NAT Gateway or Instance instead of creating a new one."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment