Skip to content

Commit 4548dd7

Browse files
authored
Fix S3_PREFIX not being written to .env (#1078)
1 parent 60b748d commit 4548dd7

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

pod-configs/module/s3/output.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: 2025 Intel Corporation
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
output "s3_prefix_used" {
6+
description = "The actual S3 prefix used in bucket names (either provided or randomly generated)"
7+
value = var.s3_prefix == "" ? tostring(random_integer.random_prefix.result) : var.s3_prefix
8+
}

pod-configs/orchestrator/cluster/output.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ output "efs_file_system_id" {
4141
}
4242

4343
output "s3_prefix" {
44+
description = "The configured S3 prefix input variable (may be empty if not explicitly set)"
4445
value = var.s3_prefix
4546
}
4647

48+
output "s3_prefix_used" {
49+
description = "The actual S3 prefix used in bucket names (either provided or randomly generated)"
50+
value = module.s3.s3_prefix_used
51+
}
52+
4753
output "sre_basic_auth_username" {
4854
value = var.sre_basic_auth_username
4955
sensitive = true

pod-configs/utils/provision.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,8 @@ EOF
11031103
echo "FILE_SYSTEM_ID=${efs_file_system_id}" >> ~/.env
11041104
fi
11051105

1106-
# export S3 prefix to .env
1107-
s3_prefix=$(terraform show -json | jq -r '.values.outputs.s3_prefix.value')
1106+
# export S3 prefix to .env (use s3_prefix_used which returns the actual prefix)
1107+
s3_prefix=$(terraform show -json | jq -r '.values.outputs.s3_prefix_used.value')
11081108
if [[ -n "$s3_prefix" && "$s3_prefix" != "null" ]]; then
11091109
echo "S3_PREFIX=${s3_prefix}" >> ~/.env
11101110
fi

0 commit comments

Comments
 (0)