Skip to content

Commit

Permalink
Merge pull request #19 from owensengoku/rename-for-workshop
Browse files Browse the repository at this point in the history
rename .tf for more easy understanding
  • Loading branch information
smalltown authored Sep 19, 2018
2 parents d013dfc + ed56a9f commit c3d7197
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 59 deletions.
26 changes: 0 additions & 26 deletions aws/eks/master/role.tf → aws/eks/master/role-eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,3 @@ resource "aws_iam_role_policy_attachment" "eks_service" {
policy_arn = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
role = "${aws_iam_role.eks.name}"
}

# Role for Spot Fleet
resource "aws_iam_role" "spot_fleet" {
name = "${var.phase}-${var.project}-fleet-role"

assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "spotfleet.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}

resource "aws_iam_role_policy_attachment" "spot_fleet" {
role = "${aws_iam_role.spot_fleet.name}"
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetTaggingRole"
}
25 changes: 25 additions & 0 deletions aws/eks/master/role-spot.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Role for Spot Fleet
resource "aws_iam_role" "spot_fleet" {
name = "${var.phase}-${var.project}-fleet-role"

assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "spotfleet.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}

resource "aws_iam_role_policy_attachment" "spot_fleet" {
role = "${aws_iam_role.spot_fleet.name}"
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetTaggingRole"
}
File renamed without changes.
30 changes: 30 additions & 0 deletions aws/eks/master/security-group-eks.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "aws_security_group" "eks" {
name_prefix = "${var.phase}-${var.project}-master-"
vpc_id = "${var.exist_vpc_id}"

tags = "${merge(map(
"Name", "${var.phase}-${var.project}-eks",
"Phase", "${var.phase}",
"Project", "${var.project}"
), var.extra_tags)}"
}

resource "aws_security_group_rule" "eks_cluster_egress" {
type = "egress"
security_group_id = "${aws_security_group.eks.id}"

from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

resource "aws_security_group_rule" "eks_cluster_ingress_https" {
type = "ingress"
security_group_id = "${aws_security_group.eks.id}"

protocol = "tcp"
cidr_blocks = ["${var.vpc_cidr_block}"]
from_port = 443
to_port = 443
}
32 changes: 0 additions & 32 deletions aws/eks/master/sg.tf → aws/eks/master/security-group-worker.tf
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
resource "aws_security_group" "eks" {
name_prefix = "${var.phase}-${var.project}-master-"
vpc_id = "${var.exist_vpc_id}"

tags = "${merge(map(
"Name", "${var.phase}-${var.project}-eks",
"Phase", "${var.phase}",
"Project", "${var.project}"
), var.extra_tags)}"
}

resource "aws_security_group_rule" "eks_cluster_egress" {
type = "egress"
security_group_id = "${aws_security_group.eks.id}"

from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

resource "aws_security_group_rule" "eks_cluster_ingress_https" {
type = "ingress"
security_group_id = "${aws_security_group.eks.id}"

protocol = "tcp"
cidr_blocks = ["${var.vpc_cidr_block}"]
from_port = 443
to_port = 443
}


resource "aws_security_group" "workers" {
name_prefix = "${var.phase}-${var.project}-worker-"
description = "Security group for all nodes in the cluster."
Expand Down
2 changes: 1 addition & 1 deletion aws/eks/worker-common/ami.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "container_linux" {
}

locals {
ami_owner = "595879546273"
ami_owner = "595879546273" # Amazon Account ID
arn = "aws"
}

Expand Down

0 comments on commit c3d7197

Please sign in to comment.