Last active
April 26, 2018 16:24
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_s3_bucket" "state_store" { | |
bucket = "${var.name}-state" | |
acl = "private" | |
force_destroy = true | |
versioning { | |
enabled = true | |
} | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_route53_zone" "public" { | |
name = "${var.name}" | |
force_destroy = true | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
😃