-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (48 loc) · 1.67 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
53
54
55
56
57
name: 'Test Opentofu Selectel Terraform modules'
on:
schedule:
- cron: '0 8 * * 5' # run every Friday at 11:00 MSK
workflow_dispatch:
jobs:
setup:
name: 'Test Opentofu Selectel Terraform modules'
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 }}
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
with:
tofu_version: 1.6.2
- 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="endpoint=s3.ru-1.storage.selcloud.ru"
-backend-config="key=github-infra-examples.tfstate"
-backend-config="region=ru-1"
-backend-config="skip_region_validation=true"
-backend-config="skip_credentials_validation=true"
-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