| Task | Description |
| 1. Understand use case and expected input output-output | Get the initial understanding of the project. Expected Input and output |
| 2. Hadover checklist | Get Handover: Checklist from Data Scientist and Review it |
| 3. Create SR for Data Sources Access | Raise SR for Required Data Sources. It’s better to have a service account setup instead of getting individual account access |
| 4. Run the scripts on local | Run all scripts on local and monitor the execution time |
| 5. SRs for SSO set, If it’s a Chatbot | Required for Cloud Memo Approval per ITD |
| 6. Architecture diagram | High level Diagram Showcasing the flow and Resources used |
| 7. Data Model | Relationship between data elements |
| 8. Table creation | Snowflake table Creation for storing output |
| 9. Process Flow | ER Diagram, Flow Diagram etc |
| 10. Code changes to dump output to snowflake | Write function to dump output into snowflake table |
| 11. Create Roles and policy create | Terraform Scripts for roles and policy creation. |
| 12. Repo creation for infrastructure — communicate –> Roles and Policy | Terraform scripts for communication of roles and policy |
| 13. Raise SR for Gitaction setup and repo whitelisting | Gitaction setup |
| 14. Build docker and run the code on docker | Docker image creation and Testing code on docker |
| 15. Pipeline Scheduler Testing end to end | Test pipeline end to end |

The diagram describes a workflow for deploying AWS infrastructure using roles and permissions via two separate pipelines. These pipelines handle different responsibilities:
Both use GitHub Actions for their CI/CD pipelines.
name: Role-Management
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
branches:
- dev
- main
# trigger this pipeline only when there is change in terraform directory
paths:
- 'terraform/**'
# For the push event to trigger the workflow, you need:
# A push to EITHER a matching tag (like v1.0.0) OR one of the specified branches
# (dev/main)
# AND changes must be in the terraform/ directory
workflow_dispatch:
inputs:
DESTROY_FLAG:
type: boolean
required: true
description: "Check this box if you want a destroy infrastructre"
# Sets required permissions for GitHub OIDC token authentication
permissions:
id-token: write
contents: read
jobs:
Infrastructure_Deployment:
runs-on: ubuntu-latest
env:
environment: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }}
account: ${{ github.ref == 'refs/heads/main' && '992382849580' || '301691044089' }}
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- name: Auth to AWS
uses: PaccarInc-Digital/actions-aws-auth@v1.1.1
with:
role: "arn:aws:iam::${{ env.account }}:role/pbc-gitactions-role-management-role"
role-hop-target: "arn:aws:iam::022592466027:role/aws-oidc-legacy-role-2"
- name: Call AWS Identity
shell: bash
run: aws sts get-caller-identity
- name: Set Environment variables
id: branch_check
run: |
echo "Running on branch ${{ github.ref }}"
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "environment=prod" >> "$GITHUB_ENV"
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
echo "environment=dev" >> "$GITHUB_ENV"
fi
- name: Remove existing Terraform state and lock file
run: |
rm -rf .terraform .terraform.lock.hcl
rm -rf .terraform
rm -rf .terraform terraform.tfstate
rm -rf .terraform terraform.tfstate.backup
rm -rf .terraform plan.tfplan
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.7
terraform_wrapper: false
- name: Terraform Init
working-directory: ./terraform
run: terraform init -backend-config="backends/${{ env.environment }}.s3.tfbackend"
- name: Terraform Plan
id: plan
working-directory: ./terraform
run: terraform plan -var-file="variables/${{ env.environment }}.tfvars" -out=plan.tfplan
continue-on-error: true
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Deploy
working-directory: ./terraform
run: |
if ${{ github.event.inputs.DESTROY_FLAG == 'true' }}; then
terraform destroy -auto-approve
else
terraform apply plan.tfplan
fi
Explain a little bit about the aws part:
- name: Auth to AWS
uses: PaccarInc-Digital/actions-aws-auth@v1.1.1
with:
role: "arn:aws:iam::${{ env.account }}:role/pbc-gitactions-role-management-role"
role-hop-target: "arn:aws:iam::022592466027:role/aws-oidc-legacy-role-2"
permissions: id-token: write at the top of the workflow enables this${{ env.account }} resolves to:
992382849580 when running on main branch (prod)301691044089 when running on other branches (dev)pbc-gitactions-role-management-role in the selected accountaws-oidc-legacy-role-2 is in a different AWS account (022592466027)aws sts get-caller-identityThis approach improves security by:
| Pipeline | Purpose | Trigger | AWS Access Method | Terraform Action |
|---|---|---|---|---|
| pbc-gitactions-role-management | Manage roles & policies | Push/Dispatch | Pre-created permissions | Create roles & policies |
| pbc-warrant-data-quality | Deploy infrastructure | Push/Dispatch | Assume role (from pipeline 1) | Create specific infrastructure |