Skip to content

Commit

Permalink
Set kube context via config path
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed May 20, 2024
1 parent 275e98a commit fe149a3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/internal-k8-infra/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ provider "spotinst" {
}

provider "kubernetes" {
config_path = "~/.kube/config"
config_path = var.kube_config_path
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
token = data.aws_eks_cluster_auth.cluster.token
}

provider "helm" {
kubernetes {
config_path = "~/.kube/config"
config_path = var.kube_config_path
}
}
6 changes: 6 additions & 0 deletions modules/internal-k8-infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ variable "cluster_name" {
default = "dpe-k8"
}

variable "kube_config_path" {
description = "Kube config path"
type = string
default = "~/.kube/config"
}

variable "region" {
description = "AWS region"
type = string
Expand Down
1 change: 1 addition & 0 deletions provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ provider "spotinst" {
}

provider "kubernetes" {
config_path = var.kube_config_path
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster.token
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ variable "cluster_version" {
default = "1.29"
}

variable "kube_config_path" {
description = "Kube config path"
type = string
default = "~/.kube/config"
}

variable "cidr" {
description = "CIDR block for the VPC"
type = string
Expand Down

0 comments on commit fe149a3

Please sign in to comment.