mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-17 17:22:13 +01:00
refactor: Refactoring to match the rest of terraform-aws-modules (#1583)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Based on the official aws-node-termination-handler setup guide at https://github.com/aws/aws-node-termination-handler#infrastructure-setup
|
||||
|
||||
provider "aws" {
|
||||
region = var.region
|
||||
region = local.region
|
||||
}
|
||||
|
||||
data "aws_caller_identity" "current" {}
|
||||
@@ -16,15 +16,14 @@ data "aws_eks_cluster_auth" "cluster" {
|
||||
|
||||
provider "kubernetes" {
|
||||
host = data.aws_eks_cluster.cluster.endpoint
|
||||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
|
||||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
|
||||
token = data.aws_eks_cluster_auth.cluster.token
|
||||
load_config_file = false
|
||||
}
|
||||
|
||||
provider "helm" {
|
||||
kubernetes {
|
||||
host = data.aws_eks_cluster.cluster.endpoint
|
||||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
|
||||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
|
||||
token = data.aws_eks_cluster_auth.cluster.token
|
||||
}
|
||||
}
|
||||
@@ -34,6 +33,7 @@ data "aws_availability_zones" "available" {
|
||||
|
||||
locals {
|
||||
cluster_name = "test-refresh-${random_string.suffix.result}"
|
||||
region = "eu-west-1"
|
||||
}
|
||||
|
||||
resource "random_string" "suffix" {
|
||||
@@ -102,7 +102,7 @@ data "aws_iam_policy_document" "aws_node_termination_handler_events" {
|
||||
"sqs:SendMessage",
|
||||
]
|
||||
resources = [
|
||||
"arn:aws:sqs:${var.region}:${data.aws_caller_identity.current.account_id}:${local.cluster_name}",
|
||||
"arn:aws:sqs:${local.region}:${data.aws_caller_identity.current.account_id}:${local.cluster_name}",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ resource "helm_release" "aws_node_termination_handler" {
|
||||
|
||||
set {
|
||||
name = "awsRegion"
|
||||
value = var.region
|
||||
value = local.region
|
||||
}
|
||||
set {
|
||||
name = "serviceAccount.name"
|
||||
|
||||
@@ -18,11 +18,6 @@ output "config_map_aws_auth" {
|
||||
value = module.eks.config_map_aws_auth
|
||||
}
|
||||
|
||||
output "region" {
|
||||
description = "AWS region."
|
||||
value = var.region
|
||||
}
|
||||
|
||||
output "sqs_queue_asg_notification_arn" {
|
||||
description = "SQS queue ASG notification ARN"
|
||||
value = module.aws_node_termination_handler_sqs.sqs_queue_arn
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
variable "region" {
|
||||
default = "us-west-2"
|
||||
}
|
||||
|
||||
variable "aws_node_termination_handler_chart_version" {
|
||||
description = "Version of the aws-node-termination-handler Helm chart to install."
|
||||
type = string
|
||||
default = "0.15.0"
|
||||
}
|
||||
|
||||
variable "namespace" {
|
||||
description = "Namespace for the aws-node-termination-handler."
|
||||
type = string
|
||||
default = "kube-system"
|
||||
}
|
||||
|
||||
variable "serviceaccount" {
|
||||
description = "Serviceaccount for the aws-node-termination-handler."
|
||||
type = string
|
||||
default = "aws-node-termination-handler"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user