-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (43 loc) · 1.46 KB
/
opentofu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: 'Modules Test Run - OpenTofu Latest'
on:
schedule:
- cron: '0 8 * * 5' # run every Friday at 11:00 MSK
workflow_dispatch:
jobs:
setup:
name: 'Modules Test Run - OpenTofu Latest'
runs-on: self-hosted
env:
TF_VAR_selectel_domain_name: ${{ secrets.SELECTEL_ID }}
TF_VAR_selectel_user_admin_user: ${{ secrets.SERVICE_USER }}
TF_VAR_selectel_user_admin_password: ${{ secrets.SERVICE_PASSWORD }}
TF_VAR_flavor_name: ${{ secrets.FLAVOR_NAME }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
- name: Add .tofurc
shell: bash
run: |
cat <<EOS >> $HOME/.tofurc
provider_installation {
network_mirror {
url = "https://tf-proxy.selectel.ru/mirror/v1/"
}
}
EOS
- name: Lint OpenTofu
run: tofu fmt -diff -check -recursive
- name: Init OpenTofu
run: >
tofu init -reconfigure
-backend-config="bucket=github-terraform-state"
-backend-config="key=github-infra-examples.tfstate"
-backend-config="access_key=${{ secrets.S3_ACCESS_KEY }}"
-backend-config="secret_key=${{ secrets.S3_SECRET_KEY }}"
- name: OpenTofu apply
run: tofu apply -auto-approve
- name: OpenTofu destroy
run: tofu destroy -auto-approve