Skip to content

Commit e5fc992

Browse files
committed
v6.1.0 - 2024/01/31
- Added testing for Terraform 1.7+ - FIX : If `var.profile` and `var.assume_role_arn` are used, then continuing to use `var.profile` invalidates the assumed role. The `aws_cli_runner.sh` now no longer uses `var.profile` when a role has been successfully assumed. Thank you [Garrett Blinkhorn](#11).
1 parent c5afc98 commit e5fc992

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
terraform_version: [1.6.6, 1.6.5, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0]
12+
terraform_version:
13+
- 1.7.1
14+
- 1.7.0
15+
- 1.6.6
16+
- 1.6.5
17+
- 1.6.4
18+
- 1.6.3
19+
- 1.6.2
20+
- 1.6.1
21+
- 1.6.0
1322

1423
steps:
1524
- name: Checkout code
@@ -31,7 +40,7 @@ jobs:
3140
tests/tests.sh
3241
3342
- name: Capture logs
34-
uses: actions/upload-artifact@v3
43+
uses: actions/upload-artifact@v4
3544
if: always()
3645
with:
3746
name: logs-${{ matrix.terraform_version }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
# v6.1.0 - 2024/01/31
4+
- Added testing for Terraform 1.7+
5+
- FIX : If `var.profile` and `var.assume_role_arn` are used, then continuing to use `var.profile` invalidates the
6+
assumed role. The `aws_cli_runner.sh` now no longer uses `var.profile` when a role has been successfully assumed.
7+
Thank you [Garrett Blinkhorn](https://github.com/digitickets/terraform-aws-cli/issues/11).
8+
39
# v6.0.2 - 2024/01/31
410
- FIX : Typo in `aws_cli_runner.sh` when running assuming a role. Thank you [Garrett Blinkhorn](https://github.com/digitickets/terraform-aws-cli/issues/11).
511

scripts/aws_cli_runner.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ if [ -n "${ASSUME_ROLE_ARN}" ]; then
9595
export AWS_ACCESS_KEY_ID=$(jq -r '.Credentials.AccessKeyId' "$AWS_STS_JSON")
9696
export AWS_SECRET_ACCESS_KEY=$(jq -r '.Credentials.SecretAccessKey' "$AWS_STS_JSON")
9797
export AWS_SESSION_TOKEN=$(jq -r '.Credentials.SessionToken' "$AWS_STS_JSON")
98+
99+
### Having assumed a role, drop the profile as that will override any credentials retrieved by the assumed role when
100+
### reused as part of the AWS CLI call.
101+
### References :
102+
### 1. https://github.com/digitickets/terraform-aws-cli/issues/11 - Thank you Garrett Blinkhorn.
103+
### 2. https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html#using-temp-creds-sdk-cli
104+
unset AWS_CLI_PROFILE_PARAM
98105
fi
99106

100107
# Do we have a query?

tests/common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function run_function() {
137137
fi
138138
}
139139

140-
function common_setup() {
140+
function common_setup() {
141141
TEST_PATH=$(dirname "${1}")
142142
TEST_NAME=$(basename "${TEST_PATH}")
143143

@@ -190,7 +190,7 @@ function common_setup() {
190190
export MODULE_TERRAFORM_AWS_CLI_RETAIN_LOGS=true
191191
}
192192

193-
function run_test() {
193+
function run_test() {
194194
if [ "${ALLOW_PLAN}" == "true" ]; then
195195
# Turn off coloured Terraform output (makes logs a little easier to read in an IDE)
196196
export TF_CLI_ARGS="-no-color"

0 commit comments

Comments
 (0)