Skip to content

Commit

Permalink
add-s3-extra-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
robervexcel authored and msvticket committed Mar 21, 2024
1 parent 12ec60d commit 043ff75
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 15 deletions.
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module "cluster" {
iops = var.iops
use_kms_s3 = var.use_kms_s3
s3_kms_arn = var.s3_kms_arn
s3_extra_tags = var.s3_extra_tags
is_jx2 = var.is_jx2
content = local.content
cluster_endpoint_public_access = var.cluster_endpoint_public_access
Expand Down Expand Up @@ -123,6 +124,7 @@ module "vault" {
use_vault = var.use_vault
region = var.region
enable_acl = var.enable_acl
s3_extra_tags = var.s3_extra_tags
}

// ----------------------------------------------------------------------------
Expand All @@ -137,6 +139,7 @@ module "backup" {
velero_username = var.velero_username
create_velero_role = var.create_velero_role
enable_acl = var.enable_acl
s3_extra_tags = var.s3_extra_tags
}

// ----------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions modules/backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ locals {
resource "aws_s3_bucket" "backup_bucket" {
count = var.enable_backup ? 1 : 0
bucket_prefix = "backup-${lower(var.cluster_name)}-"
tags = {
Owner = "Jenkins-x"
}
tags = merge(var.s3_default_tags, var.s3_extra_tags)
force_destroy = var.force_destroy
}

Expand Down
12 changes: 12 additions & 0 deletions modules/backup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ variable "s3_kms_arn" {
default = ""
}

variable "s3_default_tags" {
description = "Default tags for s3 buckets"
type = map
default = { Owner = "Jenkins-x" }
}

variable "s3_extra_tags" {
description = "Add new tags for s3 buckets"
type = map
default = {}
}

variable "is_jx2" {
default = true
type = bool
Expand Down
12 changes: 3 additions & 9 deletions modules/cluster/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ locals {
resource "aws_s3_bucket" "logs_jenkins_x" {
count = var.enable_logs_storage ? 1 : 0
bucket_prefix = "logs-${lower(var.cluster_name)}-"
tags = {
Owner = "Jenkins-x"
}
tags = merge(var.s3_default_tags, var.s3_extra_tags)
force_destroy = var.force_destroy
}

Expand Down Expand Up @@ -52,9 +50,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "logs_jenkins_x" {
resource "aws_s3_bucket" "reports_jenkins_x" {
count = var.enable_reports_storage ? 1 : 0
bucket_prefix = "reports-${lower(var.cluster_name)}-"
tags = {
Owner = "Jenkins-x"
}
tags = merge(var.s3_default_tags, var.s3_extra_tags)
force_destroy = var.force_destroy
}

Expand Down Expand Up @@ -92,9 +88,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "reports_jenkins_x
resource "aws_s3_bucket" "repository_jenkins_x" {
count = var.enable_repository_storage ? 1 : 0
bucket_prefix = "repository-${lower(var.cluster_name)}-"
tags = {
Owner = "Jenkins-x"
}
tags = merge(var.s3_default_tags, var.s3_extra_tags)
force_destroy = var.force_destroy
}

Expand Down
13 changes: 13 additions & 0 deletions modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ variable "use_kms_s3" {
default = false
}

variable "s3_default_tags" {
description = "Default tags for s3 buckets"
type = map
default = { Owner = "Jenkins-x" }
}

variable "s3_extra_tags" {
description = "Add new tags for s3 buckets"
type = map
default = {}
}


variable "map_accounts" {
description = "Additional AWS account numbers to add to the aws-auth configmap."
type = list(string)
Expand Down
4 changes: 1 addition & 3 deletions modules/vault/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ resource "aws_s3_bucket" "vault-unseal-bucket" {
count = local.create_vault_resources ? 1 : 0

bucket_prefix = "vault-unseal-${lower(var.cluster_name)}-"
tags = {
Name = "Vault unseal bucket"
}
tags = merge(var.s3_default_tags, var.s3_extra_tags)
force_destroy = var.force_destroy
}

Expand Down
12 changes: 12 additions & 0 deletions modules/vault/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ variable "s3_kms_arn" {
default = ""
}

variable "s3_default_tags" {
description = "Default tags for s3 buckets"
type = map
default = { Name = "Vault unseal bucket" }
}

variable "s3_extra_tags" {
description = "Add new tags for s3 buckets"
type = map
default = {}
}

variable "is_jx2" {
default = true
type = bool
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ variable "s3_kms_arn" {
default = ""
}

variable "s3_extra_tags" {
description = "Add new tags for s3 buckets"
type = map
default = {}
}

variable "is_jx2" {
default = true
type = bool
Expand Down

0 comments on commit 043ff75

Please sign in to comment.