-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amended Docker run and gen-env script
An issue in which the environment variables which were not explicitly TF_VAR_ or ENV would not be available to the Docker container's environment when running was discovered. By changing how we source the whole .env file and run various commands the environment variables are fully availible for the environemt for both terraform and scripting purposes.
- Loading branch information
Stephen James
committed
Dec 11, 2023
1 parent
a0d80cc
commit d923dfb
Showing
2 changed files
with
34 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,11 +60,11 @@ cat << EOF > ./.env | |
# then run "make init" | ||
export AWS_PROFILE=mojo-shared-services-cli | ||
export AWS_VAULT_PROFILE=mojo-shared-services-cli | ||
AWS_PROFILE=mojo-shared-services-cli | ||
AWS_VAULT_PROFILE=mojo-shared-services-cli | ||
### ${ENV} ### | ||
export ENV=${ENV} | ||
ENV=${ENV} | ||
## buildspec defaults | ||
|
@@ -75,27 +75,27 @@ export ENV=${ENV} | |
## This value has been applied to the envs via AWS CodePipeline CI. | ||
## We don't want to use the default variable's value here. | ||
export [email protected] | ||
[email protected] | ||
## This value has been applied to the envs via AWS CodePipeline CI. | ||
## There is no default value set in the variables.tf. | ||
export TF_VAR_enable_authentication=true | ||
TF_VAR_enable_authentication=true | ||
## This value has been applied to the envs via AWS CodePipeline CI. | ||
export TF_VAR_enable_hosted_zone=true | ||
TF_VAR_enable_hosted_zone=true | ||
## This value has been applied to the envs via AWS CodePipeline CI. | ||
export TF_VAR_enable_nac_transit_gateway_attachment=true | ||
TF_VAR_enable_nac_transit_gateway_attachment=true | ||
EOF | ||
|
||
for key in "${!parameters[@]}" | ||
do | ||
## uppercase key do not prefix with TF_VAR | ||
if [[ "${key}" =~ [A-Z] ]]; then | ||
echo "export ${key}=${parameters[${key}]}" >> ./.env | ||
echo "${key}=${parameters[${key}]}" >> ./.env | ||
else | ||
echo "export TF_VAR_${key}=${parameters[${key}]}" >> ./.env | ||
echo "TF_VAR_${key}=${parameters[${key}]}" >> ./.env | ||
fi | ||
done | ||
|
||
|