DDLS-408 add encryption to remaining dynamo table #302
Workflow file for this run
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
name: "[Workflow] Destroy ephemeral environment" | |
permissions: | |
id-token: write | |
contents: read | |
security-events: none | |
pull-requests: write | |
actions: none | |
checks: none | |
deployments: none | |
issues: none | |
packages: none | |
repository-projects: none | |
statuses: none | |
defaults: | |
run: | |
shell: bash | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
workspace_name: | |
runs-on: ubuntu-latest | |
name: output workflow variables | |
outputs: | |
build_identifier: ${{ steps.variables.outputs.build_identifier }} | |
steps: | |
- uses: actions/checkout@3b9b8c884f6b4bb4d5be2779c26374abadae0871 # pin@v3 | |
- name: extract variables for workflow | |
id: variables | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: | | |
export BRANCH=$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF##*/}} | awk -F'_' '{print $1}' | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]' | cut -c1-8) | |
echo "build_identifier=$(echo ${BRANCH}${PR_NUMBER})" >> $GITHUB_OUTPUT | |
cleanup_workspace: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
needs: | |
- workspace_name | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- id: terraform_version | |
name: get terraform version | |
uses: ministryofjustice/opg-github-actions/.github/actions/terraform-version@v3.1.0 | |
with: | |
terraform_directory: terraform/environment | |
- uses: hashicorp/setup-terraform@344fef46b6edc7c46ce8b3b8b0a3ece7e77e05f0 # pin@v2.0.0 | |
with: | |
terraform_version: ${{ steps.terraform_version.outputs.version }} | |
terraform_wrapper: false | |
- uses: webfactory/ssh-agent@fd34b8dee206fe74b288a5e61bc95fba2f1911eb # pin@v0.5.4 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_ALLOW_LIST_REPOSITORY }} | |
- name: configure OIDC AWS credentials for terraform | |
uses: aws-actions/configure-aws-credentials@97834a484a5ab3c40fa9e2eb40fcf8041105a573 | |
with: | |
role-to-assume: arn:aws:iam::631181914621:role/oidc-digideps-development | |
role-session-name: github-actions-terraform | |
role-duration-seconds: 3600 | |
aws-region: eu-west-1 | |
- name: clean up environment | |
working-directory: ./terraform/environment | |
env: | |
WORKSPACE: ${{ needs.workspace_name.outputs.build_identifier }} | |
TF_VAR_OPG_DOCKER_TAG: foo | |
run: | | |
echo "Running script against ${WORKSPACE}" | |
./scripts/destroy_workspace.sh ${WORKSPACE} |