Skip to content

drift

drift #146

Workflow file for this run

name: drift
on:
schedule:
# At 10:00 PM JST
- cron: "0 13 * * 6,0"
env:
SLACK_USERNAME: DriftDetectBot
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK: "https://hooks.slack.com/services/${{ secrets.WEBHOOK_PATH }}"
TF_VAR_WEBHOOK_PATH: ${{ secrets.WEBHOOK_PATH }}
TF_VAR_github_token: ${{ secrets.TF_VAR_github_token }}
TF_VERSION: 1.7.5
AWS_REGION: ap-northeast-1
AWS_IAM_ROLE_ARN: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/minecraft-test-github-actions
permissions:
id-token: write
contents: read
pull-requests: read
jobs:
drift:
name: Drift
runs-on: ubuntu-latest
strategy:
matrix:
dir: [
terraform/scheduling,
terraform/keeping
]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_IAM_ROLE_ARN }}
role-session-name: github-actions-test-session
aws-region: ${{ env.AWS_REGION }}
- name: Create Mapping Yaml(only scheduling)
if: ${{ matrix.dir == 'terraform/scheduling' }}
working-directory: ${{ matrix.dir }}
run: |
cat << EOF > secrets.yaml
OPS: ${{ secrets.WHITELIST_PLAYERS }}
WHITELIST: ${{ secrets.WHITELIST_PLAYERS }}
WEBHOOK_PATH: ${{ secrets.WEBHOOK_PATH }}
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
S3_PREFIX_NAME: ${{ secrets.S3_PREFIX_NAME }}
FILTERING_STRINGS: ${{ secrets.FILTERING_STRINGS }}
EOF
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Terraform Init
run: terraform init -lock=false
working-directory: ${{ matrix.dir }}
- name: Terraform Plan
run: terraform plan -lock=false -detailed-exitcode
working-directory: ${{ matrix.dir }}
- name: Nothing Drift
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: Nothing Drift
SLACK_COLOR: good
SLACK_MESSAGE: ${{ matrix.dir }}にはDriftがありません
- name: Detect Drift
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: Detect Drift
SLACK_COLOR: danger
SLACK_MESSAGE: ${{ matrix.dir }}でDriftを検知しました