Skip to content

Commit

Permalink
Set S3 bucket name in a local variable (to be used in multiple locati…
Browse files Browse the repository at this point in the history
…ons)
  • Loading branch information
eldada committed Feb 26, 2025
1 parent ae8f928 commit a21ecb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 6.artifactory-aws-install/artifactory.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "local_file" "artifactory_values" {
maxCacheSize: "${local.cache-fs-size}000000000"
awsS3V3:
region: "${var.region}"
bucketName: "artifactory-${var.region}-${var.env_name}"
bucketName: "${local.artifactory_s3_bucket_name}"
database:
url: "jdbc:postgresql://${aws_db_instance.artifactory_db.endpoint}/${var.db_name}?sslmode=require"
Expand Down
5 changes: 4 additions & 1 deletion 6.artifactory-aws-install/s3.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# This file is used to create an S3 bucket for Artifactory to store binaries
locals {
artifactory_s3_bucket_name = "artifactory-${var.region}-${var.env_name}"
}

resource "aws_s3_bucket" "artifactory_binarystore" {
bucket = "artifactory-${var.region}-${var.env_name}"
bucket = local.artifactory_s3_bucket_name

# WARNING: This will force the bucket to be destroyed even if it's not empty
force_destroy = true
Expand Down

0 comments on commit a21ecb1

Please sign in to comment.