Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move RAM association job to reusable workflow and switch secrets source to AWS Secrets Manager #8993

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/core-logging-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash
Expand All @@ -37,7 +38,7 @@ jobs:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-logging"
environment: production
environment: "production"
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
7 changes: 4 additions & 3 deletions .github/workflows/core-network-services-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash
Expand All @@ -38,7 +39,7 @@ jobs:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-network-services"
environment: production
environment: "production"
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
7 changes: 4 additions & 3 deletions .github/workflows/core-security-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash
Expand All @@ -37,7 +38,7 @@ jobs:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-security"
environment: production
environment: "production"
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
7 changes: 4 additions & 3 deletions .github/workflows/core-shared-services-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash
Expand All @@ -43,7 +44,7 @@ jobs:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-shared-services"
environment: production
environment: "production"
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
52 changes: 4 additions & 48 deletions .github/workflows/core-vpc-development-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,57 +51,13 @@ defaults:
run:
shell: bash

env:
AWS_REGION: "eu-west-2"
ENVIRONMENT_MANAGEMENT: ${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}
TF_ENV: "development"
jobs:
core-vpc-development-deployment-plan-apply:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-vpc"
environment: development
environment: "development"
run_ram_association: true
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

member-account-ram-association:
runs-on: [ ubuntu-latest ]
if: github.event.ref == 'refs/heads/main'
needs: [ core-vpc-development-deployment-plan-apply ]
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Set Account Number
run: |
ACCOUNT_NUMBER=$(jq -r -e '.modernisation_platform_account_id' <<< $ENVIRONMENT_MANAGEMENT)
echo "::add-mask::$ACCOUNT_NUMBER"
echo ACCOUNT_NUMBER=$ACCOUNT_NUMBER >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: "arn:aws:iam::${{ env.ACCOUNT_NUMBER }}:role/github-actions-apply"
role-session-name: githubactionsrolesession
aws-region: ${{ env.AWS_REGION }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false

- name: Run RAM association if needed
run: bash scripts/get-applications-and-run-ram.sh ${TF_ENV}

- name: Slack failure notification
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
webhook-type: incoming-webhook
payload: |
{"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ failure() }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
53 changes: 5 additions & 48 deletions .github/workflows/core-vpc-preproduction-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ on:
- '!**.md'
workflow_dispatch:

env:
AWS_REGION: "eu-west-2"
ENVIRONMENT_MANAGEMENT: ${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}
TF_ENV: "preproduction"
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash
Expand All @@ -59,48 +56,8 @@ jobs:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-vpc"
environment: preproduction
environment: "preproduction"
run_ram_association: true
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

member-account-ram-association:
runs-on: [ ubuntu-latest ]
if: github.event.ref == 'refs/heads/main'
needs: [ core-vpc-preproduction-deployment-plan-apply ]
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Set Account Number
run: |
ACCOUNT_NUMBER=$(jq -r -e '.modernisation_platform_account_id' <<< $ENVIRONMENT_MANAGEMENT)
echo "::add-mask::$ACCOUNT_NUMBER"
echo ACCOUNT_NUMBER=$ACCOUNT_NUMBER >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: "arn:aws:iam::${{ env.ACCOUNT_NUMBER }}:role/github-actions-apply"
role-session-name: githubactionsrolesession
aws-region: ${{ env.AWS_REGION }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false

- name: Run RAM association if needed
run: bash scripts/get-applications-and-run-ram.sh ${TF_ENV}

- name: Slack failure notification
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
webhook-type: incoming-webhook
payload: |
{"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ failure() }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
53 changes: 5 additions & 48 deletions .github/workflows/core-vpc-production-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,61 +46,18 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash

env:
AWS_REGION: "eu-west-2"
ENVIRONMENT_MANAGEMENT: ${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}
TF_ENV: "production"
jobs:
core-vpc-production-deployment-plan-apply:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-vpc"
environment: production
environment: "production"
run_ram_association: true
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

member-account-ram-association:
runs-on: [ ubuntu-latest ]
if: github.event.ref == 'refs/heads/main'
needs: [ core-vpc-production-deployment-plan-apply ]
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Set Account Number
run: |
ACCOUNT_NUMBER=$(jq -r -e '.modernisation_platform_account_id' <<< $ENVIRONMENT_MANAGEMENT)
echo "::add-mask::$ACCOUNT_NUMBER"
echo ACCOUNT_NUMBER=$ACCOUNT_NUMBER >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: "arn:aws:iam::${{ env.ACCOUNT_NUMBER }}:role/github-actions-apply"
role-session-name: githubactionsrolesession
aws-region: ${{ env.AWS_REGION }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false

- name: Run RAM association if needed
run: bash scripts/get-applications-and-run-ram.sh ${TF_ENV}

- name: Slack failure notification
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
webhook-type: incoming-webhook
payload: |
{"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ failure() }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
53 changes: 5 additions & 48 deletions .github/workflows/core-vpc-test-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,61 +44,18 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

defaults:
run:
shell: bash

env:
AWS_REGION: "eu-west-2"
ENVIRONMENT_MANAGEMENT: ${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}
TF_ENV: "test"
jobs:
core-vpc-test-deployment-plan-apply:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/environments/core-vpc"
environment: test
environment: "test"
run_ram_association: true
secrets:
modernisation_platform_environments: "${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

member-account-ram-association:
runs-on: [ ubuntu-latest ]
if: github.event.ref == 'refs/heads/main'
needs: [ core-vpc-test-deployment-plan-apply ]
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Set Account Number
run: |
ACCOUNT_NUMBER=$(jq -r -e '.modernisation_platform_account_id' <<< $ENVIRONMENT_MANAGEMENT)
echo "::add-mask::$ACCOUNT_NUMBER"
echo ACCOUNT_NUMBER=$ACCOUNT_NUMBER >> $GITHUB_ENV

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: "arn:aws:iam::${{ env.ACCOUNT_NUMBER }}:role/github-actions-apply"
role-session-name: githubactionsrolesession
aws-region: ${{ env.AWS_REGION }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false

- name: Run RAM association if needed
run: bash scripts/get-applications-and-run-ram.sh ${TF_ENV}

- name: Slack failure notification
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
webhook-type: incoming-webhook
payload: |
{"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ failure() }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
5 changes: 3 additions & 2 deletions .github/workflows/modernisation-platform-account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write

jobs:
modernisation-platform-account-plan-and-apply:
uses: ./.github/workflows/reusable_terraform_plan_apply.yml
with:
working-directory: "terraform/modernisation-platform-account"
workflow_id: "modernisation-platform-account"
secrets:
modernisation_platform_environments: ${{ secrets.MODERNISATION_PLATFORM_ENVIRONMENTS }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MODERNISATION_PLATFORM_ACCOUNT_NUMBER: ${{ secrets.MODERNISATION_PLATFORM_ACCOUNT_NUMBER }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
Loading
Loading