From 5a130e9a54ee18fc06789cc79246255c776ac6a2 Mon Sep 17 00:00:00 2001 From: oskar Date: Sat, 22 Jun 2019 21:00:30 +0800 Subject: [PATCH] add AWS EKS basic terraform cluster --- tf/aws/README.md | 7 ++ tf/aws/cm.yaml | 12 +++ tf/aws/eks-cluster.tf | 87 ++++++++++++++++++ tf/aws/eks-worker-nodes.tf | 145 ++++++++++++++++++++++++++++++ tf/aws/outputs.tf | 59 ++++++++++++ tf/aws/providers.tf | 19 ++++ tf/aws/variables.tf | 21 +++++ tf/aws/vpc.tf | 57 ++++++++++++ tf/aws/workstation-external-ip.tf | 18 ++++ 9 files changed, 425 insertions(+) create mode 100644 tf/aws/README.md create mode 100644 tf/aws/cm.yaml create mode 100644 tf/aws/eks-cluster.tf create mode 100644 tf/aws/eks-worker-nodes.tf create mode 100644 tf/aws/outputs.tf create mode 100644 tf/aws/providers.tf create mode 100644 tf/aws/variables.tf create mode 100644 tf/aws/vpc.tf create mode 100644 tf/aws/workstation-external-ip.tf diff --git a/tf/aws/README.md b/tf/aws/README.md new file mode 100644 index 0000000..30ffab8 --- /dev/null +++ b/tf/aws/README.md @@ -0,0 +1,7 @@ +# EKS Getting Started Guide Configuration + +This is the full configuration from https://www.terraform.io/docs/providers/aws/guides/eks-getting-started.html + +See that guide for additional information. + +NOTE: This full configuration utilizes the [Terraform http provider](https://www.terraform.io/docs/providers/http/index.html) to call out to icanhazip.com to determine your local workstation external IP for easily configuring EC2 Security Group access to the Kubernetes master servers. Feel free to replace this as necessary. diff --git a/tf/aws/cm.yaml b/tf/aws/cm.yaml new file mode 100644 index 0000000..41e428a --- /dev/null +++ b/tf/aws/cm.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: aws-auth + namespace: kube-system +data: + mapRoles: | + - rolearn: arn:aws:iam::703476792259:role/terraform-eks-demo-node + username: system:node:{{EC2PrivateDNSName}} + groups: + - system:bootstrappers + - system:nodes diff --git a/tf/aws/eks-cluster.tf b/tf/aws/eks-cluster.tf new file mode 100644 index 0000000..b9f9754 --- /dev/null +++ b/tf/aws/eks-cluster.tf @@ -0,0 +1,87 @@ +# +# EKS Cluster Resources +# * IAM Role to allow EKS service to manage other AWS services +# * EC2 Security Group to allow networking traffic with EKS cluster +# * EKS Cluster +# + +resource "aws_iam_role" "demo-cluster" { + name = "terraform-eks-demo-cluster" + + assume_role_policy = <