Skip to content
Merged
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
70 changes: 7 additions & 63 deletions .github/workflows/terraform-foundation-1-org-b.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,66 +16,10 @@ on:

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
working-directory: ./environment/foundation/1-org-b/

# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v3

# gcp auth
- name: GCP login
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}

# gcloud setup
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
skip_install: true

# Installs terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.9.5

# Checks for proper formatting in terraform code
- name: Terraform Fmt
run: terraform fmt

# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=foundation/1-org-b

# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Validate
run: terraform validate

# Generates terraform execution plan
- name: Terraform Plan
run: terraform plan -input=false -var-file=1-org-b.tfvars -no-color ${{ github.event_name == 'schedule' && '-detailed-exitcode' || '' }}

# On push to main, build or change infrastructure according to Terraform configuration files
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -var-file=1-org-b.tfvars -refresh=false -auto-approve

- name: Report status
if: failure() && github.ref == 'refs/heads/main'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: failure
notification_title: 'idf_deploy: Periodic plan for {workflow} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
name: Terraform
uses: ./.github/workflows/_reusable-terraform-plan-apply.yaml
with:
working_directory: ./environment/foundation/1-org-b/
state_prefix: foundation/1-org-b
tfvars_file: 1-org-b.tfvars
secrets: inherit
70 changes: 7 additions & 63 deletions .github/workflows/terraform-foundation-1-org.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,66 +16,10 @@ on:

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
working-directory: ./environment/foundation/1-org/

# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v3

# gcp auth
- name: GCP login
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}

# gcloud setup
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
skip_install: true

# Installs terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.9.5

# Checks for proper formatting in terraform code
- name: Terraform Fmt
run: terraform fmt

# Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=foundation/1-org

# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Validate
run: terraform validate

# Generates an execution plan for terraform
- name: Terraform Plan
run: terraform plan -input=false -var-file=1-org.tfvars -no-color ${{ github.event_name == 'schedule' && '-detailed-exitcode' || '' }}

# On push to main, build or change infrastructure according to Terraform configuration files
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -var-file=1-org.tfvars -refresh=false -auto-approve

- name: Report status
if: failure() && github.ref == 'refs/heads/main'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: failure
notification_title: 'idf_deploy: Periodic plan for {workflow} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
name: Terraform
uses: ./.github/workflows/_reusable-terraform-plan-apply.yaml
with:
working_directory: ./environment/foundation/1-org/
state_prefix: foundation/1-org
tfvars_file: 1-org.tfvars
secrets: inherit
70 changes: 7 additions & 63 deletions .github/workflows/terraform-foundation-2-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,66 +16,10 @@ on:

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
working-directory: ./environment/foundation/2-networks/

# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v3

# gcp auth
- name: GCP login
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}

# gcloud setup
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
skip_install: true

# Installs terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.9.5

# Checks for proper formatting
- name: Terraform Fmt
run: terraform fmt

# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=foundation/2-networks

# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Validate
run: terraform validate

# Generates an execution plan for terraform
- name: Terraform Plan
run: terraform plan -input=false -var-file=network.tfvars -no-color ${{ github.event_name == 'schedule' && '-detailed-exitcode' || '' }}

# On push to main, build or change infrastructure according to Terraform configuration files
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -var-file=network.tfvars -refresh=false -auto-approve

- name: Report status
if: failure() && github.ref == 'refs/heads/main'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: failure
notification_title: 'idf_deploy: Periodic plan for {workflow} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
name: Terraform
uses: ./.github/workflows/_reusable-terraform-plan-apply.yaml
with:
working_directory: ./environment/foundation/2-networks/
state_prefix: foundation/2-networks
tfvars_file: network.tfvars
secrets: inherit
70 changes: 7 additions & 63 deletions .github/workflows/terraform-foundation-monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,66 +16,10 @@ on:

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
working-directory: ./environment/foundation/monitoring/

# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v3

# gcp auth
- name: GCP login
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}

# gcloud setup
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
skip_install: true

# Installs terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.9.5

# Checks for proper formatting
- name: Terraform Fmt
run: terraform fmt

# Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=foundation/monitoring

# Checks that all terraform configuration files adhere to a canonical format
- name: Terraform Validate
run: terraform validate

# Generates an execution plan for terraform
- name: Terraform Plan
run: terraform plan -input=false -var-file=monitoring.tfvars -no-color ${{ github.event_name == 'schedule' && '-detailed-exitcode' || '' }}

# On push to main, build or change infrastructure according to Terraform configuration files
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -var-file=monitoring.tfvars -refresh=false -auto-approve

- name: Report status
if: failure() && github.ref == 'refs/heads/main'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: failure
notification_title: 'idf_deploy: Periodic plan for {workflow} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
name: Terraform
uses: ./.github/workflows/_reusable-terraform-plan-apply.yaml
with:
working_directory: ./environment/foundation/monitoring/
state_prefix: foundation/monitoring
tfvars_file: monitoring.tfvars
secrets: inherit
71 changes: 7 additions & 64 deletions .github/workflows/terraform-google-groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,10 @@ on:

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest

# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
working-directory: ./environment/foundation/google_groups/

# Checkout the repository to the GitHub Actions runner
steps:
- name: Checkout
uses: actions/checkout@v3

# gcp auth
- name: GCP login
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}

# gcloud setup
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
skip_install: true

# Installs terraform
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.9.5

# Checks for proper formatting in terraform code
- name: Terraform Fmt
run: terraform fmt

# Initialize a new or existing terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init -backend-config=bucket=${{ secrets.TERRAFORM_STATE_BUCKET }} -backend-config=prefix=foundation/google_groups

# Checks that all terraform configuration files adhere to a canonical format
- name: Terraform Validate
run: terraform validate

# Generates an execution plan for terraform
- name: Terraform Plan
id: plan
run: terraform plan -input=false -var-file=env/groups.tfvars -no-color ${{ github.event_name == 'schedule' && '-detailed-exitcode' || '' }}

# On push to main, build or change infrastructure according to terraform configuration files
- name: Terraform Apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -var-file=env/groups.tfvars -auto-approve

- name: Report status
if: failure() && github.ref == 'refs/heads/main'
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: failure
notification_title: 'idf_deploy: Periodic plan for {workflow} failed'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
name: Terraform
uses: ./.github/workflows/_reusable-terraform-plan-apply.yaml
with:
working_directory: ./environment/foundation/google_groups/
state_prefix: foundation/google_groups
tfvars_file: env/groups.tfvars
secrets: inherit
Loading