-
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.
Merge pull request #2 from digital-society-coop/update-naming
Switch to new naming convention
- Loading branch information
Showing
3 changed files
with
65 additions
and
17 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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
function usage { | ||
echo "Usage: $0 <service> <env>" >&2 | ||
exit 1 | ||
} | ||
|
||
[[ $# -ge 1 ]] || usage | ||
service="$1" | ||
shift | ||
|
||
[[ $# -ge 1 ]] || usage | ||
environment="$1" | ||
shift | ||
|
||
|
||
stateBucket="$service-$environment-terraform" | ||
stateKey="$service/$environment.tfstate" | ||
|
||
tfCliArgs=( | ||
'-input=false' | ||
) | ||
|
||
tfCliArgsInit=( | ||
${tfCliArgs[@]} | ||
"-backend-config=region=${AWS_REGION:-"$(aws configure get region)"}" | ||
"-backend-config=bucket=$stateBucket" | ||
"-backend-config=key=$stateKey" | ||
'-lockfile=readonly' | ||
'-reconfigure' | ||
) | ||
|
||
tfCliArgsPlan=( | ||
${tfCliArgs[@]} | ||
) | ||
|
||
tfCliArgsApply=( | ||
${tfCliArgsPlan[@]} | ||
'-auto-approve' | ||
) | ||
|
||
echo "export TF_CLI_ARGS_init='${tfCliArgsInit[@]}'" | ||
echo "export TF_CLI_ARGS_plan='${tfCliArgsPlan[@]}'" | ||
echo "export TF_CLI_ARGS_apply='${tfCliArgsApply[@]}'" | ||
echo "stateBucket=$stateBucket" |