Apply #338
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: Apply | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 6 * * 1" | |
env: | |
TF_LOG: ${{ secrets.TF_LOG}} | |
TF_VAR_billing_account_id: ${{ secrets.BILLING_ACCOUNT_ID }} | |
TF_VAR_seed_sa_email: ${{ secrets.SEED_SA_EMAIL_ADDRESS }} | |
TF_VAR_github_admin_token: ${{ secrets.ADMIN_GITHUB_TOKEN }} | |
TF_VAR_project_postfix: ${{ secrets.GCP_PROJECT_POSTFIX }} | |
TF_VAR_workload_identity_provider_name: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | |
TF_VAR_workload_identity_pool_name: ${{ secrets.WORKLOAD_IDENTITY_POOL_ID }} | |
TF_VAR_codacy_api_token: ${{ secrets.CODACY_API_TOKEN }} | |
TF_VAR_docker_registry_username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
TF_VAR_docker_registry_token: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
TF_IN_AUTOMATION: true | |
TF_INPUT: false | |
GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} | |
CLOUDSDK_CORE_PROJECT: ${{ secrets.GCP_PROJECT_ID }} | |
permissions: | |
id-token: write | |
jobs: | |
security-scan: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Security scan | |
uses: aquasecurity/[email protected] | |
with: | |
scan-type: config | |
trivy-config: trivy.yaml | |
ignore-unfixed: false | |
compliance-scan: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Checkov action | |
id: checkov | |
uses: bridgecrewio/[email protected] | |
apply: | |
runs-on: ubuntu-20.04 | |
needs: | |
- compliance-scan | |
- security-scan | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Authenticating | |
uses: google-github-actions/[email protected] | |
with: | |
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SEED_SA_EMAIL_ADDRESS }} | |
- name: Setting up GCP environment | |
uses: google-github-actions/[email protected] | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Init | |
run: terraform init -backend-config="bucket=${{ secrets.TERRAFORM_STATE_BUCKET }}" | |
- name: Apply | |
run: terraform apply -auto-approve | |
- name: Show Terraform Output as Summary | |
run: | | |
{ | |
echo "### Terraform Output"; | |
echo "\`\`\`"; | |
terraform output; | |
echo "\`\`\`"; | |
} > "${GITHUB_STEP_SUMMARY}" |