-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Added pre-commit gitleaks 2. Lock versions for testing 3. Added var.profile and var.region to allow greater control at runtime 4. Renamed script to aws_cli_runner.sh 5. Refactored variable processing and usage within output filename and passing to aws_cli_runner.sh 6. Updated all tests for latest version of Terraform (not idea I guess, but the main users are upgraded) 7. Replaced Travis CI with GitHub Actions
- Loading branch information
Showing
25 changed files
with
278 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: jq --version; aws --version; terraform --version | ||
- run: git clone https://github.com/tfutils/tfenv.git ~/.tfenv | ||
- run: ~/.tfenv/bin/tfenv install | ||
- uses: actions/checkout@v4 | ||
- run: tests/tests.sh | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: logs | ||
path: test-reports/**/* |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,32 @@ | ||
{ | ||
"assume_role_arn": { | ||
"value": "" | ||
}, | ||
"aws_cli_commands": { | ||
"value": [ | ||
"s3api", | ||
"list-objects", | ||
"--bucket", | ||
"ryft-public-sample-data", | ||
"--no-sign-request" | ||
] | ||
}, | ||
"aws_cli_query": { | ||
"value": "max_by(Contents, &Size)" | ||
}, | ||
"debug_log_filename": { | ||
"value": "test-reports/invalid_profile_with_debug/debug.log" | ||
}, | ||
"external_id": { | ||
"value": "" | ||
}, | ||
"profile": { | ||
"value": "this_profile_does_not_exist" | ||
}, | ||
"region": { | ||
"value": "" | ||
}, | ||
"role_session_name": { | ||
"value": "invalid_profile_with_debug" | ||
} | ||
} |
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,6 @@ | ||
// ryft-public-sample-data is a publicly accessible S3 bucket. | ||
aws_cli_commands = ["s3api", "list-objects", "--bucket", "ryft-public-sample-data", "--no-sign-request"] | ||
aws_cli_query = "max_by(Contents, &Size)" | ||
role_session_name = "invalid_profile_with_debug" | ||
profile = "this_profile_does_not_exist" | ||
debug_log_filename = "test-reports/invalid_profile_with_debug/debug.log" |
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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
function run_test() { | ||
if [[ ! -f $PLAN_FILE ]]; then | ||
echo "Failed to generate a plan - $PLAN_FILE"; | ||
exit 1; | ||
fi | ||
|
||
if [[ ! "$(terraform show -json $PLAN_FILE | jq -MSr .variables)" == "$(cat $EXPECTED_VARIABLES)" ]]; then | ||
echo 'Failed to incorporate expected variable values into plan.'; | ||
exit 2; | ||
fi | ||
|
||
if [[ ! "$(cat $DEBUG_LOG_FILE)" == *'The config profile (this_profile_does_not_exist) could not be found'* ]]; then | ||
echo 'Failed to generate error from bad profile name.'; | ||
exit 3; | ||
fi | ||
} | ||
|
||
. tests/common.sh $0 |
32 changes: 32 additions & 0 deletions
32
tests/invalid_profile_without_debug/expected_variables.json
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,32 @@ | ||
{ | ||
"assume_role_arn": { | ||
"value": "" | ||
}, | ||
"aws_cli_commands": { | ||
"value": [ | ||
"s3api", | ||
"list-objects", | ||
"--bucket", | ||
"ryft-public-sample-data", | ||
"--no-sign-request" | ||
] | ||
}, | ||
"aws_cli_query": { | ||
"value": "max_by(Contents, &Size)" | ||
}, | ||
"debug_log_filename": { | ||
"value": "" | ||
}, | ||
"external_id": { | ||
"value": "" | ||
}, | ||
"profile": { | ||
"value": "this_profile_does_not_exist" | ||
}, | ||
"region": { | ||
"value": "" | ||
}, | ||
"role_session_name": { | ||
"value": "invalid_profile_without_debug" | ||
} | ||
} |
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,5 @@ | ||
// ryft-public-sample-data is a publicly accessible S3 bucket. | ||
aws_cli_commands = ["s3api", "list-objects", "--bucket", "ryft-public-sample-data", "--no-sign-request"] | ||
aws_cli_query = "max_by(Contents, &Size)" | ||
role_session_name = "invalid_profile_without_debug" | ||
profile = "this_profile_does_not_exist" |
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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
function run_test() { | ||
if [[ ! -f $PLAN_FILE ]]; then | ||
echo "Failed to generate a plan - $PLAN_FILE"; | ||
exit 1; | ||
fi | ||
|
||
if [[ ! "$(terraform show -json $PLAN_FILE | jq -MSr .variables)" == "$(cat $EXPECTED_VARIABLES)" ]]; then | ||
echo 'Failed to incorporate expected variable values into plan.'; | ||
exit 2; | ||
fi | ||
|
||
if [[ ! "$(cat $PLAN_ERROR_FILE)" == *'The config profile (this_profile_does_not_exist) could not be found'* ]]; then | ||
echo 'Failed to generate error from bad profile name during planning.'; | ||
exit 3; | ||
fi | ||
} | ||
|
||
. tests/common.sh $0 |
Oops, something went wrong.