mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-28 04:11:07 +01:00
adding tags I didnt realize were necessary
This commit is contained in:
@@ -31,6 +31,7 @@ data "http" "workstation_external_ip" {
|
|||||||
|
|
||||||
locals {
|
locals {
|
||||||
workstation_external_cidr = "${chomp(data.http.workstation_external_ip.body)}/32"
|
workstation_external_cidr = "${chomp(data.http.workstation_external_ip.body)}/32"
|
||||||
|
cluster_name = "test-eks-${random_string.suffix.result}"
|
||||||
|
|
||||||
tags = "${map("Environment", "test",
|
tags = "${map("Environment", "test",
|
||||||
"GithubRepo", "terraform-aws-eks",
|
"GithubRepo", "terraform-aws-eks",
|
||||||
@@ -54,7 +55,7 @@ module "vpc" {
|
|||||||
public_subnets = ["10.0.3.0/24", "10.0.4.0/24"]
|
public_subnets = ["10.0.3.0/24", "10.0.4.0/24"]
|
||||||
enable_nat_gateway = true
|
enable_nat_gateway = true
|
||||||
single_nat_gateway = true
|
single_nat_gateway = true
|
||||||
tags = "${local.tags}"
|
tags = "${merge(local.tags, map("kubernetes.io/cluster/${local.cluster_name}", "shared"))}"
|
||||||
}
|
}
|
||||||
|
|
||||||
module "security_group" {
|
module "security_group" {
|
||||||
@@ -67,7 +68,7 @@ module "security_group" {
|
|||||||
|
|
||||||
module "eks" {
|
module "eks" {
|
||||||
source = "../.."
|
source = "../.."
|
||||||
cluster_name = "test-eks-${random_string.suffix.result}"
|
cluster_name = "${local.cluster_name}"
|
||||||
subnets = "${module.vpc.public_subnets}"
|
subnets = "${module.vpc.public_subnets}"
|
||||||
tags = "${local.tags}"
|
tags = "${local.tags}"
|
||||||
vpc_id = "${module.vpc.vpc_id}"
|
vpc_id = "${module.vpc.vpc_id}"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ resource "aws_autoscaling_group" "workers" {
|
|||||||
tags = ["${concat(
|
tags = ["${concat(
|
||||||
list(
|
list(
|
||||||
map("key", "Name", "value", "${var.cluster_name}-eks_asg", "propagate_at_launch", true),
|
map("key", "Name", "value", "${var.cluster_name}-eks_asg", "propagate_at_launch", true),
|
||||||
|
map("key", "kubernetes.io/cluster/${var.cluster_name}", "value", "owned", "propagate_at_launch", true),
|
||||||
),
|
),
|
||||||
local.asg_tags)
|
local.asg_tags)
|
||||||
}"]
|
}"]
|
||||||
@@ -32,7 +33,8 @@ resource "aws_security_group" "workers" {
|
|||||||
name_prefix = "${var.cluster_name}"
|
name_prefix = "${var.cluster_name}"
|
||||||
description = "Security group for all nodes in the cluster."
|
description = "Security group for all nodes in the cluster."
|
||||||
vpc_id = "${var.vpc_id}"
|
vpc_id = "${var.vpc_id}"
|
||||||
tags = "${merge(var.tags, map("Name", "${var.cluster_name}-eks_worker_sg"))}"
|
tags = "${merge(var.tags, map("Name", "${var.cluster_name}-eks_worker_sg", "kubernetes.io/cluster/${var.cluster_name}", "owned"
|
||||||
|
))}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_security_group_rule" "workers_egress_internet" {
|
resource "aws_security_group_rule" "workers_egress_internet" {
|
||||||
|
|||||||
Reference in New Issue
Block a user