diff --git a/s3/locals.tf b/s3/locals.tf index f355ee8e..55270647 100644 --- a/s3/locals.tf +++ b/s3/locals.tf @@ -1,7 +1,10 @@ locals { tags = { - Application = var.application - Environment = var.environment + application = var.application + environment = var.environment + managed-by = "DBT Platform - Terraform" + copilot-application = var.application + copilot-environment = var.environment } name = "${var.application}-${var.environment}-${var.name}" diff --git a/s3/tests/s3.tftest.hcl b/s3/tests/s3.tftest.hcl index ef5df761..754f74d7 100644 --- a/s3/tests/s3.tftest.hcl +++ b/s3/tests/s3.tftest.hcl @@ -21,12 +21,27 @@ run "e2e_test" { } assert { - condition = aws_s3_bucket.this.tags["Environment"] == "s3-test-environment" + condition = aws_s3_bucket.this.tags["environment"] == "s3-test-environment" error_message = "Invalid s3 bucket tags" } assert { - condition = aws_s3_bucket.this.tags["Application"] == "s3-test-application" + condition = aws_s3_bucket.this.tags["application"] == "s3-test-application" + error_message = "Invalid s3 bucket tags" + } + + assert { + condition = aws_s3_bucket.this.tags["copilot-application"] == "s3-test-application" + error_message = "Invalid s3 bucket tags" + } + + assert { + condition = aws_s3_bucket.this.tags["copilot-environment"] == "s3-test-environment" + error_message = "Invalid s3 bucket tags" + } + + assert { + condition = aws_s3_bucket.this.tags["managed-by"] == "DBT Platform - Terraform" error_message = "Invalid s3 bucket tags" } @@ -50,12 +65,12 @@ run "e2e_test" { ### Test aws_kms_key tags ### assert { - condition = aws_kms_key.kms-key.tags["Application"] == "s3-test-application" + condition = aws_kms_key.kms-key.tags["application"] == "s3-test-application" error_message = "Invalid s3 KMS key tags" } assert { - condition = aws_kms_key.kms-key.tags["Environment"] == "s3-test-environment" + condition = aws_kms_key.kms-key.tags["environment"] == "s3-test-environment" error_message = "Invalid s3 KMS key tags" }