Code Monkey home page Code Monkey logo

devops-tf-eks's Issues

Explanation of local.env and terraform.workspace

First off want to say stellar work man I really appreciate you putting all of this together!

It seems just about every K8 tutorial is around setting everything up from scratch in a new VPC. Ideally I'd like to spin up this TF plan inside my existing VPC so we can begin to migrate from docker swarm to this cluster. My plan was to basically skip the initial stage of the VPC config and then translate the rest of the config to match our existing IDs.

The TF variable file I've been handed down is very basic compared to this, I did read up on what workspaces are and we aren't using them to my knowledge. (Or maybe just using the default one, I've never changed workspaces.)

The two thing's I'm confused on are

  1. What ${terraform.workspace} is going to do, is it just going to use the existing workspace or is it defining a new one?
  2. What is ${local.env} doing? I've noticed it defined in a few places is that simply calling the locals envs?

I'm sure I can take all of that stuff out and dumb it down to match our stuff but if you don't mind explaining how those work I'd really appreciate it!

locals {
  env = "${terraform.workspace}"

  availabilityzone = "${var.AWS_REGION}a"
  availabilityzone2 = "${var.AWS_REGION}b"

  cluster_name= "${local.env}-cluster"

//  NOTE: The usage of the specific kubernetes.io/cluster/*
//  resource tags below are required for EKS and Kubernetes to discover
//  and manage networking resources.

  common_tags = "${map(
    "Environment", "${local.env}",
    "kubernetes.io/cluster/${local.cluster_name}", "shared"
  )}"
}
  name = "EKSClusterRole-${local.env}",
  description = "Allows EKS to manage clusters on your behalf.",
  assume_role_policy = <<POLICY
{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Effect":"Allow",
         "Principal":{
            "Service":"eks.amazonaws.com"
         },
         "Action":"sts:AssumeRole"
      }
   ]
}
POLICY
}```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.