From 04a61b2bc7e64f9c99f21e0c887d760b63a95acb Mon Sep 17 00:00:00 2001 From: ankitm123 Date: Thu, 13 May 2021 10:37:41 -0400 Subject: [PATCH] fix: make clustername lowercase so that s3 bucket names are valid (#260) Signed-off-by: ankitm123 --- modules/backup/main.tf | 2 +- modules/cluster/main.tf | 2 -- modules/cluster/storage.tf | 6 +++--- modules/vault/main.tf | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/backup/main.tf b/modules/backup/main.tf index 38ad1ac..7ac5a8e 100644 --- a/modules/backup/main.tf +++ b/modules/backup/main.tf @@ -11,7 +11,7 @@ locals { resource "aws_s3_bucket" "backup_bucket" { count = var.enable_backup ? 1 : 0 - bucket_prefix = "backup-${var.cluster_name}-" + bucket_prefix = "backup-${lower(var.cluster_name)}-" acl = "private" tags = { Owner = "Jenkins-x" diff --git a/modules/cluster/main.tf b/modules/cluster/main.tf index 4b5560d..dc05407 100644 --- a/modules/cluster/main.tf +++ b/modules/cluster/main.tf @@ -13,8 +13,6 @@ data "aws_availability_zones" "available" {} data "aws_caller_identity" "current" {} -data "aws_partition" "current" {} - // ---------------------------------------------------------------------------- // Define K8s cluster configuration // ---------------------------------------------------------------------------- diff --git a/modules/cluster/storage.tf b/modules/cluster/storage.tf index bf8b527..f439296 100644 --- a/modules/cluster/storage.tf +++ b/modules/cluster/storage.tf @@ -8,7 +8,7 @@ locals { resource "aws_s3_bucket" "logs_jenkins_x" { count = var.enable_logs_storage ? 1 : 0 - bucket_prefix = "logs-${var.cluster_name}-" + bucket_prefix = "logs-${lower(var.cluster_name)}-" acl = "private" tags = { Owner = "Jenkins-x" @@ -26,7 +26,7 @@ resource "aws_s3_bucket" "logs_jenkins_x" { resource "aws_s3_bucket" "reports_jenkins_x" { count = var.enable_reports_storage ? 1 : 0 - bucket_prefix = "reports-${var.cluster_name}-" + bucket_prefix = "reports-${lower(var.cluster_name)}-" acl = "private" tags = { Owner = "Jenkins-x" @@ -44,7 +44,7 @@ resource "aws_s3_bucket" "reports_jenkins_x" { resource "aws_s3_bucket" "repository_jenkins_x" { count = var.enable_repository_storage ? 1 : 0 - bucket_prefix = "repository-${var.cluster_name}-" + bucket_prefix = "repository-${lower(var.cluster_name)}-" acl = "private" tags = { Owner = "Jenkins-x" diff --git a/modules/vault/main.tf b/modules/vault/main.tf index 06ec417..ae70aec 100644 --- a/modules/vault/main.tf +++ b/modules/vault/main.tf @@ -36,7 +36,7 @@ data "aws_iam_user" "vault_user" { resource "aws_s3_bucket" "vault-unseal-bucket" { count = local.create_vault_resources ? 1 : 0 - bucket_prefix = "vault-unseal-${var.cluster_name}-" + bucket_prefix = "vault-unseal-${lower(var.cluster_name)}-" acl = "private" tags = { Name = "Vault unseal bucket"