From 4e41ea963191745bf68bef370951aeda83866325 Mon Sep 17 00:00:00 2001 From: Robert Northard Date: Wed, 16 Aug 2023 19:52:19 +0100 Subject: [PATCH] Tidy --- examples/private-public-ingress/main.tf | 34 +++++++++++++++++++- examples/private-public-ingress/outputs.tf | 4 +++ examples/private-public-ingress/providers.tf | 30 ----------------- 3 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 examples/private-public-ingress/outputs.tf delete mode 100644 examples/private-public-ingress/providers.tf diff --git a/examples/private-public-ingress/main.tf b/examples/private-public-ingress/main.tf index b49dc9829f..61141c3a70 100644 --- a/examples/private-public-ingress/main.tf +++ b/examples/private-public-ingress/main.tf @@ -1,3 +1,34 @@ +provider "aws" { + region = local.region +} + +provider "kubernetes" { + host = module.eks.cluster_endpoint + cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) + token = data.aws_eks_cluster_auth.this.token +} + +provider "aws" { + region = "us-east-1" + alias = "virginia" +} + +provider "helm" { + kubernetes { + host = module.eks.cluster_endpoint + cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) + token = data.aws_eks_cluster_auth.this.token + } +} + +provider "kubectl" { + apply_retry_count = 10 + host = module.eks.cluster_endpoint + cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) + load_config_file = false + token = data.aws_eks_cluster_auth.this.token +} + data "aws_eks_cluster_auth" "this" { name = module.eks.cluster_name } @@ -6,7 +37,8 @@ data "aws_caller_identity" "current" {} data "aws_availability_zones" "available" {} locals { - name = "eks-private-public-ingress" + region = "eu-west-1" + name = "eks-private-public-ingress" vpc_cidr = "10.0.0.0/16" azs = slice(data.aws_availability_zones.available.names, 0, 3) diff --git a/examples/private-public-ingress/outputs.tf b/examples/private-public-ingress/outputs.tf new file mode 100644 index 0000000000..2089697e66 --- /dev/null +++ b/examples/private-public-ingress/outputs.tf @@ -0,0 +1,4 @@ +output "configure_kubectl" { + description = "Configure kubectl: make sure you're logged in with the correct AWS profile and run the following command to update your kubeconfig" + value = "aws eks update-kubeconfig --name ${module.eks.cluster_name} --alias ${module.eks.cluster_name}" +} \ No newline at end of file diff --git a/examples/private-public-ingress/providers.tf b/examples/private-public-ingress/providers.tf deleted file mode 100644 index 9b24e901a8..0000000000 --- a/examples/private-public-ingress/providers.tf +++ /dev/null @@ -1,30 +0,0 @@ -provider "aws" { - region = "me-central-1" -} - -provider "kubernetes" { - host = module.eks.cluster_endpoint - cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - token = data.aws_eks_cluster_auth.this.token -} - -provider "aws" { - region = "us-east-1" - alias = "virginia" -} - -provider "helm" { - kubernetes { - host = module.eks.cluster_endpoint - cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - token = data.aws_eks_cluster_auth.this.token - } -} - -provider "kubectl" { - apply_retry_count = 10 - host = module.eks.cluster_endpoint - cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - load_config_file = false - token = data.aws_eks_cluster_auth.this.token -}