From 09aab514b62694965b0d0c94a2e7c9247cb53182 Mon Sep 17 00:00:00 2001 From: Aymen Ben Tanfous Date: Mon, 15 Jan 2024 12:08:20 +0100 Subject: [PATCH] Added aws profile variable when trying to install cast.ai using the eks_cluster_existing example Signed-off-by: Aymen Ben Tanfous --- examples/eks/eks_cluster_existing/castai.tf | 2 +- examples/eks/eks_cluster_existing/providers.tf | 6 ++++-- examples/eks/eks_cluster_existing/variables.tf | 8 +++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/eks/eks_cluster_existing/castai.tf b/examples/eks/eks_cluster_existing/castai.tf index a46977da..a69ab186 100644 --- a/examples/eks/eks_cluster_existing/castai.tf +++ b/examples/eks/eks_cluster_existing/castai.tf @@ -23,7 +23,7 @@ provider "helm" { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" # This requires the awscli to be installed locally where Terraform is executed. - args = ["eks", "get-token", "--cluster-name", var.cluster_name, "--region", var.cluster_region] + args = ["eks", "get-token", "--cluster-name", var.cluster_name, "--region", var.cluster_region, "--profile", var.profile] } } } diff --git a/examples/eks/eks_cluster_existing/providers.tf b/examples/eks/eks_cluster_existing/providers.tf index 7978c5ff..40419f1d 100644 --- a/examples/eks/eks_cluster_existing/providers.tf +++ b/examples/eks/eks_cluster_existing/providers.tf @@ -1,8 +1,10 @@ # Following providers required by EKS and VPC modules. provider "aws" { - region = var.cluster_region + region = var.cluster_region + profile = var.profile } + provider "kubernetes" { host = data.aws_eks_cluster.existing_cluster.endpoint cluster_ca_certificate = base64decode(data.aws_eks_cluster.existing_cluster.certificate_authority.0.data) @@ -10,6 +12,6 @@ provider "kubernetes" { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" # This requires the awscli to be installed locally where Terraform is executed - args = ["eks", "get-token", "--cluster-name", var.cluster_name, "--region", var.cluster_region] + args = ["eks", "get-token", "--cluster-name", var.cluster_name, "--region", var.cluster_region, "--profile", var.profile] } } diff --git a/examples/eks/eks_cluster_existing/variables.tf b/examples/eks/eks_cluster_existing/variables.tf index 24a6f4ee..13f25fb7 100644 --- a/examples/eks/eks_cluster_existing/variables.tf +++ b/examples/eks/eks_cluster_existing/variables.tf @@ -1,4 +1,10 @@ # EKS module variables. +variable "profile" { + type = string + description = "Profile used with AWS CLI" + default = "default" +} + variable "cluster_name" { type = string description = "EKS cluster name in AWS account." @@ -58,4 +64,4 @@ variable "node_security_group_id" { variable "subnets" { type = list(string) description = "Subnet IDs used by CAST AI to provision nodes" -} +} \ No newline at end of file