From dc76c24f1dbd390d2377ec59716640ae1338739f Mon Sep 17 00:00:00 2001 From: Anthony Zawacki Date: Tue, 26 Sep 2023 16:47:43 -0400 Subject: [PATCH] Example that can terraform plan for sample output. --- examples/simple/eks-configuration.tf | 15 +++++++++++ examples/simple/providers.tf | 33 +++++++++++++++++++++++ examples/simple/variables.tf | 40 ++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 examples/simple/eks-configuration.tf create mode 100644 examples/simple/providers.tf create mode 100644 examples/simple/variables.tf diff --git a/examples/simple/eks-configuration.tf b/examples/simple/eks-configuration.tf new file mode 100644 index 0000000..2005892 --- /dev/null +++ b/examples/simple/eks-configuration.tf @@ -0,0 +1,15 @@ +module "eks-configuration" { + source = "git@github.it.census.gov:SOA/tfmod-eks-storage-classes.git//" + #source = "git@github.it.census.gov:SOA/tfmod-eks-configuration.git//?ref=v1.0.0" + + region = var.region + profile = var.profile + vpc_id = var.vpc_id + + cluster_name = var.cluster_name + subnets = var.subnets + security_group_all_worker_mgmt_id = var.security_group_all_worker_mgmt_id + + oidc_provider_arn = var.oidc_provider_arn + eks_managed_node_groups_autoscaling_group_names = var.eks_managed_node_groups_autoscaling_group_names +} diff --git a/examples/simple/providers.tf b/examples/simple/providers.tf new file mode 100644 index 0000000..d33658b --- /dev/null +++ b/examples/simple/providers.tf @@ -0,0 +1,33 @@ +terraform { + required_version = ">= 1.5.0" +} + +provider "aws" { + profile = var.profile + region = var.region +} + +data "aws_eks_cluster" "cluster" { + name = var.cluster_name +} + +data "aws_eks_cluster_auth" "cluster" { + name = var.cluster_name +} + +provider "kubernetes" { + 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 { + 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 + } +} + diff --git a/examples/simple/variables.tf b/examples/simple/variables.tf new file mode 100644 index 0000000..0bfe98e --- /dev/null +++ b/examples/simple/variables.tf @@ -0,0 +1,40 @@ +variable "cluster_name" { + description = "EKS cluster name name component used through out the EKS cluster describing its purpose (ex: dice-dev)" + type = string +} + +variable "region" { + description = "AWS region" + type = string +} + +variable "profile" { + description = "AWS config profile" + type = string +} + +variable "vpc_id" { + description = "Specify the VPC id that is used by this cluster" + type = string +} + +variable "subnets" { + description = "Specify the subnets used by this cluster" + type = list(string) +} + +variable "security_group_all_worker_mgmt_id" { + description = "The security group representing all of the worker nodes in the cluster." + type = string +} + +variable "eks_managed_node_groups_autoscaling_group_names" { + description = "List of the autoscaling group names created by EKS managed node groups" + type = list(string) +} + +variable "oidc_provider_arn" { + description = "The ARN of the OIDC Provider if `enable_irsa = true`" + type = string +} +