Skip to content

shazChaudhry/terraform-eks

Repository files navigation

Terraform

This repo is inspired by Amazon EKS Blueprints for Terraform.

This project includes the following components:

Prerequisites

  • An AWS account
  • A configured AWS CLI
  • AWS IAM Authenticator
  • kubectl
  • Ensure that AWS credentials are available at: "~/.aws/credentials" on the host dev machine
      [default]
      aws_access_key_id = <KEY>
      aws_secret_access_key = <SECRET>
      region = <REGION>
  • Ensure that an S3 bucket as a backend type is created inversions.tf. See the docs here
      terraform {
        backend "s3" {
          key            = "eks/terraform.tfstate"
          region         = "<REGION>"
          encrypt        = true
          # Lock Terraform State with S3 bucket in DynamoDB - https://www.terraform.io/docs/language/settings/backends/s3.html#dynamodb-state-locking
          dynamodb_table = "statefile"
        }
      }

Setup cluster

Run the following command to set up the cluster

export environment=dev
# Initialize Terraform workspace
terraform init -backend-config=environments/${environment}/backend.tf
# Review the planned actions before continuing
terraform apply --var-file=environments/${environment}/${environment}.tfvars
# Configure kubectl
aws eks --region $(terraform output -raw region) update-kubeconfig --name $(terraform output -raw cluster_name)

Destroy cluster

terraform apply -destroy -var-file=environments/${environment}/${environment}.tfvars

Fix this error

Doc for enabling this add-on is on this page:https://aws-ia.github.io/terraform-aws-eks-blueprints/v4.21.0/add-ons/kube-state-metrics/. It appears that this particular add-on is currently disabled and the blueprint docs have yet to be (annoyingly) corrected. Here is the closed issue: aws-ia/terraform-aws-eks-blueprints#464 (comment)

Error: Unsupported argument
 on kubernetes_addons.tf line 23, in module "eks_blueprints_kubernetes_addons":
 23:   enable_kube_state_metrics           = true
 An argument named "enable_kube_state_metrics" is not expected here.

References

About

Create Amazon EKS cluster with Terraform where EKS private API server endpoint is enabled.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages