Skip to content

Commit

Permalink
fix: DBTP-1534 - Assume role policy for the S3 migration were too str…
Browse files Browse the repository at this point in the history
…ict so relaxing them (#279)

Co-authored-by: Will Gibson <[email protected]>
  • Loading branch information
antroy-madetech and WillGibson authored Nov 13, 2024
1 parent 4f44598 commit 3ea79ff
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Addresses [DBTP-<ticket>](https://uktrade.atlassian.net/browse/DBTP-<ticket>)

Please add any relevant context for you pull request here, or delete this if none needed.

---
## Checklist:

### Title:
- [ ] Scope included as per [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
- [ ] Ticket reference included (unless it's a quick out of ticket thing)
### Description:
- [ ] Link to ticket included (unless it's a quick out of ticket thing)
- [ ] Includes tests (or an explanation for why it doesn't)
- [ ] Includes any applicable changes to the documentation in this code base
- [ ] Includes link(s) to any applicable changes to the documentation in the [DBT Platform Documentation](https://platform.readme.trade.gov.uk/) (can be to a pull request)
### Tasks:
- [ ] [Trigger the pull request regression tests for this branch](https://github.com/uktrade/platform-tools?tab=readme-ov-file#regression-tests) and confirm that they are passing
2 changes: 1 addition & 1 deletion environment-pipelines/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ data "aws_iam_policy_document" "iam" {
actions = [
"iam:UpdateAssumeRolePolicy"
]
resources = [for environment in local.environment_config : "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.application}-${environment.name}-shared-S3MigrationRole"]
resources = [for environment in local.environment_config : "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/*-S3MigrationRole"]
}

statement {
Expand Down
21 changes: 21 additions & 0 deletions terraform_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

unit_test_files=$(find . -name "*tftest.hcl" | grep -v e2e-tests | sort)
modules=""
IFS=$'\n'
for file in $unit_test_files
do
# Lose leading ./ and select the part before the tests directory
module=$(echo "${file#./}" | awk -F "/tests/" '{print $1}')
# In case we separate the test files, only include each module once
if [[ "\"${modules}\"" != *"\"${module}\""* ]]; then
message="Running tests for module ${module}"
underline=$(echo "${message}" | sed "s/./=/g")
echo -en "\n\033[1;36m${message}\033[0m"
echo -e "\n\033[1;36m${underline}\033[0m"
pushd "${module}"
terraform init
terraform test
popd
fi
done

0 comments on commit 3ea79ff

Please sign in to comment.