From 727156e96ae8687688ab42ead932766d72538d4e Mon Sep 17 00:00:00 2001 From: Avrohom Gottlieb Date: Wed, 4 Dec 2024 15:41:34 -0500 Subject: [PATCH] add batch tags to all batch resources --- infrastructure/batch.tf | 5 ++++- infrastructure/batch/compute_environment.tf | 2 +- infrastructure/batch/job_definition.tf | 2 ++ infrastructure/batch/job_queue.tf | 2 +- infrastructure/batch/roles.tf | 6 +++--- infrastructure/batch/security.tf | 2 +- infrastructure/batch/variables.tf | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/infrastructure/batch.tf b/infrastructure/batch.tf index f0b03c3d..48fe7ec8 100644 --- a/infrastructure/batch.tf +++ b/infrastructure/batch.tf @@ -20,5 +20,8 @@ # general configuration user = var.user stage = var.stage - default_tags = var.default_tags + batch_tags = { + module = "batch", + revision = "initial - 16vCPU compute env and 1 queue" + } } diff --git a/infrastructure/batch/compute_environment.tf b/infrastructure/batch/compute_environment.tf index 63906a5a..ba7667ae 100644 --- a/infrastructure/batch/compute_environment.tf +++ b/infrastructure/batch/compute_environment.tf @@ -18,5 +18,5 @@ resource "aws_batch_compute_environment" "scpca_portal_project" { type = "MANAGED" depends_on = [aws_iam_role_policy_attachment.batch_service_role] - tags = var.default_tags + tags = var.batch_tags } diff --git a/infrastructure/batch/job_definition.tf b/infrastructure/batch/job_definition.tf index c9422855..746ac265 100644 --- a/infrastructure/batch/job_definition.tf +++ b/infrastructure/batch/job_definition.tf @@ -90,4 +90,6 @@ resource "aws_batch_job_definition" "scpca_portal_project" { retry_strategy { attempts = 3 } + + tags = var.batch_tags } diff --git a/infrastructure/batch/job_queue.tf b/infrastructure/batch/job_queue.tf index 0c23582b..1044cd0e 100644 --- a/infrastructure/batch/job_queue.tf +++ b/infrastructure/batch/job_queue.tf @@ -7,5 +7,5 @@ resource "aws_batch_job_queue" "scpca_portal_project" { aws_batch_compute_environment.scpca_portal_project.arn, ] - tags = var.default_tags + tags = var.batch_tags } diff --git a/infrastructure/batch/roles.tf b/infrastructure/batch/roles.tf index 60c4cecb..2c235388 100644 --- a/infrastructure/batch/roles.tf +++ b/infrastructure/batch/roles.tf @@ -15,7 +15,7 @@ resource "aws_iam_role" "batch_service_role" { } EOF - tags = var.default_tags + tags = var.batch_tags } resource "aws_iam_role_policy_attachment" "batch_service_role" { @@ -41,7 +41,7 @@ resource "aws_iam_role" "ecs_task_role" { } EOF - tags = var.default_tags + tags = var.batch_tags } resource "aws_iam_role_policy_attachment" "ecs_task_execution" { @@ -66,7 +66,7 @@ resource "aws_iam_role" "batch_job_role" { } EOF - tags = var.default_tags + tags = var.batch_tags } resource "aws_iam_policy" "batch_job_s3_access" { diff --git a/infrastructure/batch/security.tf b/infrastructure/batch/security.tf index f0ce3c54..16c89237 100644 --- a/infrastructure/batch/security.tf +++ b/infrastructure/batch/security.tf @@ -1,7 +1,7 @@ resource "aws_security_group" "scpca_portal_batch" { name = "scpca-portal-batch-security-group-${var.user}-${var.stage}" vpc_id = var.scpca_portal_vpc.id - tags = var.default_tags + tags = var.batch_tags egress { from_port = 0 diff --git a/infrastructure/batch/variables.tf b/infrastructure/batch/variables.tf index c1cdba3e..f88fa908 100644 --- a/infrastructure/batch/variables.tf +++ b/infrastructure/batch/variables.tf @@ -17,4 +17,4 @@ variable "scpca_portal_db_security_group" { default = "" } # general configuration variable "user" { default = "" } variable "stage" { default = "" } -variable "default_tags" { default = "" } +variable "batch_tags" { default = "" }