Skip to content

Commit

Permalink
add tags, update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gabelton committed Apr 11, 2024
1 parent bedef58 commit 40a087a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
7 changes: 5 additions & 2 deletions s3/locals.tf
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down
23 changes: 19 additions & 4 deletions s3/tests/s3.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -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"
}

Expand Down

0 comments on commit 40a087a

Please sign in to comment.