Merge pull request #1492 from GiganticMinecraft/fix/environmentName #1255
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: Terraform apply | |
on: | |
push: | |
# terraform が file(...) でファイルを参照することがあり、 | |
# 参照されたファイルが変更された場合 re-apply する必要があるので、 | |
# main へのコミット時は常に apply していい | |
branches: | |
- "main" | |
workflow_dispatch: | |
jobs: | |
tf_apply: | |
name: tf apply | |
runs-on: ubuntu-latest | |
concurrency: tf_apply_on_main | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TERRAFORM_CLOUD_API_TOKEN }} | |
terraform_version: 1.2.1 | |
- name: Open tunnel to OnP k8s cluster | |
run: bash "./.github/workflows/scripts/open-tunnel-to-onp-k8s-and-export-tf-var-to-github-env.sh" | |
- name: Expose all Terraform variables to environment variables from secrets | |
run: bash "./.github/workflows/scripts/expose-all-tf-vars-to-github-env.sh" | |
env: | |
SECRETS_CONTEXT: ${{ toJson(secrets) }} | |
- run: terraform init | |
working-directory: "./terraform" | |
- name: Terraform apply | |
run: terraform apply -input=false -no-color -auto-approve -lock-timeout=10m | |
working-directory: "./terraform" | |
env: | |
TF_VAR_cloudflare_api_key: ${{ secrets.TF_VAR_CLOUDFLARE_API_KEY }} | |
TF_VAR_cloudflare_email: ${{ secrets.TF_VAR_CLOUDFLARE_EMAIL }} |