Skip to content

Refresh State of Repos' Environments #58

Refresh State of Repos' Environments

Refresh State of Repos' Environments #58

name: Refresh State of Repos' Environments
on:
schedule:
- cron: "0 2 * * *" # Runs at 2:00 AM UTC every night
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
terraform_refresh:
name: Refresh Terraform
runs-on: ubuntu-latest
permissions: # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.9.3 # Use the latest Terraform version or the version you need
- name: Initialize Terraform
run: terraform init
- name: Validate Terraform
run: terraform validate
- name: Refresh Terraform
run: terraform apply -refresh-only
env:
TF_VAR_github_owner: ${{ github.actor }}
TF_VAR_github_token: ${{ secrets.GH_PAT }}
TF_TOKEN_app_terraform_io: ${{ secrets.TF_TOKEN }} # used as a bearer authorization token when the CLI makes service requests to the hostname app.terraform.io