Skip to content

Commit 16874e5

Browse files
committed
Updating function names to snake case and adding descriptions
1 parent 642b02c commit 16874e5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

operations/_scripts/generate/generate_buckets_identifiers.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ set -e
44

55
GITHUB_IDENTIFIER="$(echo $($GITHUB_ACTION_PATH/operations/_scripts/generate/generate_identifier.sh) | tr '[:upper:]' '[:lower:]')"
66

7-
function generateIdentifiers () {
7+
# Function: generate_identifiers
8+
# Description: Generate all identifiers needs to poulate the IaC (terraform and ansible). Identifiers are a required component as cloud resources often have strict usage conventions that need to be appied to dynamic user input.
9+
function generate_identifiers () {
810
# Generate TF_STATE_BUCKET ID if empty
911
if [ -z "${TF_STATE_BUCKET}" ]; then
1012
if [[ ${#GITHUB_IDENTIFIER} < 55 ]]; then
@@ -22,8 +24,10 @@ function generateIdentifiers () {
2224
export LB_LOGS_BUCKET="${GITHUB_IDENTIFIER}-lg"
2325
fi
2426
}
25-
26-
function checkBucket() {
27+
# Function: check_bucket_names
28+
# Description: Runs a handful of RegEx to ensure strict usage requirements are followed.
29+
function generate_bucket_names() {
30+
2731
# check length of bucket name
2832
if [[ ${#1} -lt 3 || ${#1} -gt 63 ]]; then
2933
echo "Bucket name must be between 3 and 63 characters long."
@@ -71,10 +75,10 @@ function checkBucket() {
7175
fi
7276
}
7377

74-
generateIdentifiers
78+
generate_identifiers
7579

76-
checkBucket $TF_STATE_BUCKET
77-
checkBucket $LB_LOGS_BUCKET
80+
generate_bucket_names $TF_STATE_BUCKET
81+
generate_bucket_names $LB_LOGS_BUCKET
7882

7983
export TF_STATE_BUCKET=${TF_STATE_BUCKET}
8084
export LB_LOGS_BUCKET=${LB_LOGS_BUCKET}

0 commit comments

Comments
 (0)