Skip to content

Commit

Permalink
EDSF-535 Add prefix to tarball/agent s3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
linda.nasredin committed Feb 5, 2024
1 parent 7c9b3c2 commit d510bc0
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/aws/agentless-gw/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ variable "binaries_location" {
s3_region = string
s3_key = string
})
description = "S3 DSF installation location. If tarball_url not set, binaries_location is used. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_key = 'installation-files/my-file'}. This means that the path to the installation file is s3://my-bucket/installation-files/my-file."
description = "S3 DSF installation location. If tarball_url not set, binaries_location is used. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_key = 'installation-files/my-file'}. This means that the path to the installation file is s3://my-bucket/installation-files/my-file"
default = {
s3_bucket = ""
s3_region = ""
Expand Down
6 changes: 2 additions & 4 deletions modules/aws/db-with-agent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ locals {
db_type = var.db_type != null ? var.db_type : random_shuffle.db.result[0]
os_type = var.os_type != null ? var.os_type : random_shuffle.os.result[0]

s3_bucket = var.binaries_location.s3_bucket
s3_region = var.binaries_location.s3_region
s3_object = var.binaries_location.s3_object != null ? var.binaries_location.s3_object : local.os_params[local.os_type].installation_filename
s3_key = var.binaries_location.s3_prefix != null && var.binaries_location.s3_object != null ? join("/", [var.binaries_location.s3_prefix, var.binaries_location.s3_object]) : local.s3_object
s3_bucket_and_prefix = var.binaries_location.s3_prefix != null ? join("/", [local.s3_bucket, var.binaries_location.s3_prefix]) : local.s3_bucket
s3_key = var.binaries_location.s3_prefix != null ? join("/", [var.binaries_location.s3_prefix, local.s3_object]) : local.s3_object
s3_bucket_and_prefix = var.binaries_location.s3_prefix != null ? join("/", [var.binaries_location.s3_bucket, var.binaries_location.s3_prefix]) : var.binaries_location.s3_bucket
}

resource "random_shuffle" "db" {
Expand Down
2 changes: 1 addition & 1 deletion modules/aws/db-with-agent/userdata.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ locals {
export PATH=$PATH:/usr/local/bin:/usr/local/bin
echo "Downloading agent:"
INSTALLATION_FILE=${local.s3_object}
aws s3 cp s3://${local.s3_bucket}/${local.s3_key} . --region ${local.s3_region}
aws s3 cp s3://${var.binaries_location.s3_bucket}/${local.s3_key} . --region ${var.binaries_location.s3_region}
chmod +x ./"$INSTALLATION_FILE"
echo "Installing agent:"
./"$INSTALLATION_FILE" -n -d ${local.agent_installation_dir}
Expand Down
2 changes: 1 addition & 1 deletion modules/aws/hub/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ variable "binaries_location" {
s3_region = string
s3_key = string
})
description = "S3 DSF installation location. If tarball_url not set, binaries_location is used. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_key = 'installation-files/my-file'}. This means that the path to the installation file is s3://my-bucket/installation-files/my-file."
description = "S3 DSF installation location. If tarball_url not set, binaries_location is used. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_key = 'installation-files/my-file'}. This means that the path to the installation file is s3://my-bucket/installation-files/my-file"
default = {
s3_bucket = ""
s3_region = ""
Expand Down
1 change: 0 additions & 1 deletion modules/aws/sonar-base-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ locals {
# For example, if the binaries_location.s3_key is "path/to/file.zip", then the s3_bucket_prefix will be "path/to"
# If the binaries_location.s3_key is "file.zip", then the s3_bucket_prefix will be null
s3_bucket_prefix = try(regex("^(.*)/[^/]+", var.binaries_location.s3_key)[0], null)
s3_key = local.s3_bucket_prefix != null ? join("/", [local.s3_bucket_prefix, var.binaries_location.s3_key]) : var.binaries_location.s3_key
s3_bucket_and_prefix = local.s3_bucket_prefix != null ? join("/", [var.binaries_location.s3_bucket, local.s3_bucket_prefix]) : var.binaries_location.s3_bucket
}

Expand Down
2 changes: 1 addition & 1 deletion modules/aws/sonar-base-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ variable "binaries_location" {
s3_region = string
s3_key = string
})
description = "S3 DSF installation location. If tarball_url not set, binaries_location is used. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_key = 'installation-files/my-file'}. This means that the path to the installation file is s3://my-bucket/installation-files/my-file."
description = "S3 DSF installation location. If tarball_url not set, binaries_location is used. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_key = 'installation-files/my-file'}. This means that the path to the installation file is s3://my-bucket/installation-files/my-file"
default = {
s3_bucket = ""
s3_region = ""
Expand Down

0 comments on commit d510bc0

Please sign in to comment.