From 97625f8da26098d64d8e325288aa5a8a70d278c0 Mon Sep 17 00:00:00 2001 From: ArchiFleKs Date: Tue, 16 Apr 2019 14:04:46 +0200 Subject: [PATCH] feat: add gpu support --- terraform/modules/eks/eks-worker-nodes.tf | 12 +++++++++++- terraform/modules/eks/variables.tf | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/terraform/modules/eks/eks-worker-nodes.tf b/terraform/modules/eks/eks-worker-nodes.tf index 6961039f..4fd8f61f 100644 --- a/terraform/modules/eks/eks-worker-nodes.tf +++ b/terraform/modules/eks/eks-worker-nodes.tf @@ -8,6 +8,16 @@ data "aws_ami" "eks-worker" { owners = ["602401143452"] # Amazon EKS AMI Account ID } +data "aws_ami" "eks-gpu-worker" { + filter { + name = "name" + values = ["amazon-eks-gpu-node-${var.kubernetes_version}*"] + } + + most_recent = true + owners = ["602401143452"] # Amazon EKS AMI Account ID +} + data "template_file" "eks-node" { count = "${length(var.node-pools)}" template = "${file("templates/eks-node.tpl")}" @@ -27,7 +37,7 @@ resource "aws_launch_template" "eks" { name = "${aws_iam_instance_profile.eks-node.*.name[count.index]}" } - image_id = "${data.aws_ami.eks-worker.id}" + image_id = "${lookup(var.node-pools[count.index], "image_id", lookup(var.node-pools[count.index], "gpu_ami", "false" ) ? data.aws_ami.eks-gpu-worker.id : data.aws_ami.eks-worker.id)}" instance_type = "${lookup(var.node-pools[count.index],"instance_type")}" name_prefix = "terraform-eks-${var.cluster-name}-node-pool-${lookup(var.node-pools[count.index],"name")}" vpc_security_group_ids = ["${aws_security_group.eks-node.id}"] diff --git a/terraform/modules/eks/variables.tf b/terraform/modules/eks/variables.tf index cdd30eae..85ea9ed1 100644 --- a/terraform/modules/eks/variables.tf +++ b/terraform/modules/eks/variables.tf @@ -39,7 +39,7 @@ variable "use_route53" { variable "kubernetes_version" { description = "EKS version" - default = "1.11" + default = "1.12" } variable "external_dns" {