Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions _sub/compute/eks-heptio/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,3 @@ resource "local_file" "kubeconfig_admin" {
}
}


# --------------------------------------------------
# AWS auth configmap - default or from Blaster S3 bucket
# --------------------------------------------------

locals {
path_default_configmap = "${path.cwd}/default-auth-cm.yaml"
}

resource "local_file" "default-configmap" {
content = local.default_auth_cm_template
filename = local.path_default_configmap
}

resource "null_resource" "enable-workers-default" {
count = var.blaster_configmap_apply ? 0 : 1

provisioner "local-exec" {
command = "kubectl --kubeconfig ${var.kubeconfig_path} apply -f ${local.path_default_configmap}"
}

depends_on = [
local_file.kubeconfig_admin,
local_file.default-configmap,
]
}

resource "null_resource" "enable-workers-from-s3" {
count = var.blaster_configmap_apply ? 1 : 0

# Terraform does not seem to re-run script, unless a trigger is defined
triggers = {
timestamp = timestamp()
}

provisioner "local-exec" {
command = "bash ${path.module}/apply_blaster_configmap.sh ${data.aws_region.current.region} ${var.kubeconfig_path} ${var.blaster_configmap_s3_bucket} ${var.blaster_configmap_key} ${local.path_default_configmap} ${var.aws_assume_role_arn}"
quiet = true
}

depends_on = [
local_file.kubeconfig_admin,
local_file.default-configmap,
]
}
13 changes: 0 additions & 13 deletions _sub/compute/eks-heptio/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ variable "aws_assume_role_arn" {
type = string
}

variable "blaster_configmap_apply" {
type = bool
default = false
}

variable "blaster_configmap_s3_bucket" {
type = string
}

variable "blaster_configmap_key" {
type = string
}

variable "kubeconfig_path" {
type = string
}
Expand Down
26 changes: 8 additions & 18 deletions compute/eks-ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,15 @@ module "eks_managed_workers_node_group" {
# OTHER
# --------------------------------------------------

module "blaster_configmap_bucket" {
source = "../../_sub/storage/s3-bucket"
deploy = length(var.blaster_configmap_bucket) >= 1 ? true : false
s3_bucket = var.blaster_configmap_bucket
additional_tags = var.blaster_configmap_bucket_tags
}

module "eks_heptio" {
source = "../../_sub/compute/eks-heptio"
cluster_name = var.eks_cluster_name
kubeconfig_path = local.kubeconfig_path
eks_endpoint = module.eks_cluster.eks_endpoint
eks_certificate_authority = module.eks_cluster.eks_certificate_authority
eks_role_arn = module.eks_workers.worker_role
blaster_configmap_apply = length(var.blaster_configmap_bucket) >= 1 ? true : false
blaster_configmap_s3_bucket = module.blaster_configmap_bucket.bucket_name
blaster_configmap_key = "configmap_${module.eks_heptio.cluster_name}_blaster.yml"
aws_assume_role_arn = var.aws_assume_role_arn
eks_k8s_auth_api_version = var.eks_k8s_auth_api_version
source = "../../_sub/compute/eks-heptio"
cluster_name = var.eks_cluster_name
kubeconfig_path = local.kubeconfig_path
eks_endpoint = module.eks_cluster.eks_endpoint
eks_certificate_authority = module.eks_cluster.eks_certificate_authority
eks_role_arn = module.eks_workers.worker_role
aws_assume_role_arn = var.aws_assume_role_arn
eks_k8s_auth_api_version = var.eks_k8s_auth_api_version
}

module "efs_fs" {
Expand Down
8 changes: 0 additions & 8 deletions compute/eks-ec2/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ output "eks_cluster_nodes_sg_id" {
value = module.eks_workers_security_group.id
}

# --------------------------------------------------
# Misc
# --------------------------------------------------

output "blaster_configmap_bucket" {
value = module.blaster_configmap_bucket.bucket_name
}

output "eks_control_subnet_ids" {
value = module.eks_cluster.subnet_ids
}
15 changes: 0 additions & 15 deletions compute/eks-ec2/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,6 @@ variable "eks_managed_nodegroups" {
}
}

# --------------------------------------------------
# Blaster Configmap
# --------------------------------------------------

variable "blaster_configmap_bucket" {
type = string
default = ""
}

variable "blaster_configmap_bucket_tags" {
description = "Add additional tags to s3 bucket"
type = map(string)
default = {}
}

# --------------------------------------------------
# Cloudwatch agent setup
# --------------------------------------------------
Expand Down
Loading