Skip to content

Instantly share code, notes, and snippets.

@ryane
Last active April 26, 2018 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryane/2e27124cc68340a550e39d8cd93ea0d5 to your computer and use it in GitHub Desktop.
Save ryane/2e27124cc68340a550e39d8cd93ea0d5 to your computer and use it in GitHub Desktop.
Code for Deploy Kubernetes in an Existing AWS VPC with Kops and Terraform post
resource "aws_s3_bucket" "state_store" {
bucket = "${var.name}-state"
acl = "private"
force_destroy = true
versioning {
enabled = true
}
...
}
module "vpc" {
source = "./modules/vpc"
name = "${var.name}"
env = "${var.env}"
vpc_cidr = "${var.vpc_cidr}"
tags {
Infra = "${var.name}"
Environment = "${var.env}"
Terraformed = "true"
KubernetesCluster = "${var.env}.${var.name}"
}
}
module "subnet_pair" {
source = "./modules/subnet-pair"
name = "${var.name}"
env = "${var.env}"
vpc_id = "${module.vpc.vpc_id}"
vpc_cidr = "${module.vpc.cidr_block}"
internet_gateway_id = "${module.vpc.internet_gateway_id}"
availability_zones = "${var.azs}"
tags {
Infra = "${var.name}"
Environment = "${var.env}"
Terraformed = "true"
KubernetesCluster = "${var.env}.${var.name}"
}
}
resource "aws_route53_zone" "public" {
name = "${var.name}"
force_destroy = true
...
}
subnets:
- egress: nat-0b2f7f77b15041515
id: subnet-8db395d6
name: us-east-1a
type: Private
zone: us-east-1a
- egress: nat-059d239e3f86f6da9
id: subnet-fd6b41d0
name: us-east-1c
type: Private
zone: us-east-1c
- egress: nat-0231eef9a93386f4a
id: subnet-5fc6dd16
name: us-east-1d
type: Private
zone: us-east-1d
- id: subnet-0ab39551
name: utility-us-east-1a
type: Utility
zone: us-east-1a
- id: subnet-656b4148
name: utility-us-east-1c
type: Utility
zone: us-east-1c
- id: subnet-cdc7dc84
name: utility-us-east-1d
type: Utility
zone: us-east-1d
subnets:
- cidr: 10.20.32.0/19
name: us-east-1a
type: Private
zone: us-east-1a
- cidr: 10.20.64.0/19
name: us-east-1c
type: Private
zone: us-east-1c
- cidr: 10.20.96.0/19
name: us-east-1d
type: Private
zone: us-east-1d
- cidr: 10.20.0.0/22
name: utility-us-east-1a
type: Utility
zone: us-east-1a
- cidr: 10.20.4.0/22
name: utility-us-east-1c
type: Utility
zone: us-east-1c
- cidr: 10.20.8.0/22
name: utility-us-east-1d
type: Utility
zone: us-east-1d
@FutureSharks
Copy link

FutureSharks commented Aug 9, 2017

I wrote a Terraform module you might be interesting in, it does much the same thing but much less steps:
https://github.com/FutureSharks/tf-kops-cluster
😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment