Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 3db0d72

Browse files
authored
Merge pull request #43 from jetstack/amazon-tf-fixes
Adds some amazon terraform fixes + kubeconfig gen
2 parents bedaf65 + 8f72fa6 commit 3db0d72

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

demo/infrastructure/amazon/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/config-map-aws-auth_*
2+
/kubeconfig_*

demo/infrastructure/amazon/ouputs.tf renamed to demo/infrastructure/amazon/outputs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ output "config" {
1010
value = "${jsonencode(local.config)}"
1111
}
1212

13-
#output "kubeconfig_command" {
14-
# value = "eksctl utils write-kubeconfig --name=cluster-${random_id.suffix.hex} --kubeconfig=$KUBECONFIG --set-kubeconfig-context=true --region=${var.region} && cat infrastructure/amazon/aws-auth.yaml | sed -e \"s~{{ROLE_ARN}}~${module.cluster.cluster_node_arn}~g\" | kubectl apply -f -"
15-
#}
13+
output "kubeconfig_command" {
14+
value = "cp infrastructure/amazon/kubeconfig_cluster-${random_id.suffix.hex} $$KUBECONFIG"
15+
}
1616

1717
output "kubeconfig" {
1818
description = "kubectl config as generated by the module."

demo/infrastructure/amazon/providers.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ variable "region" {
22
default = "eu-west-1"
33
}
44

5+
variable "cluster_version" {
6+
default = "1.12"
7+
}
8+
59
provider "aws" {
610
region = "${var.region}"
711
}
812

913
module "cluster" {
10-
source = "../modules/amazon-cluster"
11-
suffix = "${random_id.suffix.hex}"
14+
source = "../modules/amazon-cluster"
15+
suffix = "${random_id.suffix.hex}"
16+
17+
cluster_version = "${var.cluster_version}"
1218
}

demo/infrastructure/modules/amazon-cluster/cluster.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
variable "suffix" {}
2+
variable "cluster_version" {}
23

34
data "aws_availability_zones" "available" {}
45

56
locals {
6-
cluster_name = "cluster-${var.suffix}"
7+
cluster_name = "cluster-${var.suffix}"
78

89
worker_groups = [
910
{
@@ -94,6 +95,7 @@ module "vpc" {
9495
module "eks" {
9596
source = "terraform-aws-modules/eks/aws"
9697
cluster_name = "${local.cluster_name}"
98+
cluster_version = "${var.cluster_version}"
9799
subnets = ["${module.vpc.private_subnets}"]
98100
tags = "${local.tags}"
99101
vpc_id = "${module.vpc.vpc_id}"

0 commit comments

Comments
 (0)