Skip to content

Commit e13db72

Browse files
authored
Support opentofu (#29)
1 parent 140258a commit e13db72

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

README.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ usage: |
7373
integrations:
7474
github:
7575
gitops:
76+
opentofu-version: 1.7.3
7677
terraform-version: 1.5.2
7778
infracost-enabled: false
7879
artifact-storage:
@@ -91,6 +92,35 @@ usage: |
9192
> [!IMPORTANT]
9293
> **Please note!** This GitHub Action only works with `atmos >= 1.63.0`. If you are using `atmos < 1.63.0` please use `v1` version of this action.
9394
95+
### Support OpenTofu
96+
97+
This action supports [OpenTofu](https://opentofu.org/).
98+
99+
> [!IMPORTANT]
100+
> **Please note!** OpenTofu supported by Atmos `>= 1.73.0`.
101+
> For details [read](https://atmos.tools/core-concepts/projects/configuration/opentofu/)
102+
103+
To enable OpenTofu add the following settings to `atmos.yaml`
104+
* Set the `opentofu-version` in the `atmos.yaml` to the desired version
105+
* Set `components.terraform.command` to `tofu`
106+
107+
#### Example
108+
109+
```yaml
110+
111+
components:
112+
terraform:
113+
command: tofu
114+
115+
...
116+
117+
integrations:
118+
github:
119+
gitops:
120+
opentofu-version: 1.7.3
121+
...
122+
```
123+
94124
### GitHub Actions Workflow Example
95125
96126
In following GitHub workflow example first job will filter components that have settings `github.actions_enabled: true` and then in following job `stack_slug` will be printed to stdout.

action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,30 @@ runs:
7272
shell: bash
7373
id: config
7474
run: |-
75+
echo "opentofu-version=$(atmos describe config -f json | jq -r '.integrations.github.gitops["opentofu-version"]')" >> $GITHUB_OUTPUT
76+
echo "terraform-version=$(atmos describe config -f json | jq -r '.integrations.github.gitops["terraform-version"]')" >> $GITHUB_OUTPUT
7577
echo "group-by=$(atmos describe config -f json | jq -r '.integrations.github.gitops.matrix["group-by"]')" >> $GITHUB_OUTPUT
7678
echo "sort-by=$(atmos describe config -f json | jq -r '.integrations.github.gitops.matrix["sort-by"]')" >> $GITHUB_OUTPUT
7779
80+
- name: Install Terraform
81+
if: ${{ steps.config.outputs.terraform-version != '' && steps.config.outputs.terraform-version != 'null' }}
82+
uses: hashicorp/setup-terraform@v3
83+
with:
84+
terraform_version: ${{ steps.config.outputs.terraform-version }}
85+
terraform_wrapper: false
86+
87+
- name: Install OpenTofu
88+
if: ${{ steps.config.outputs.opentofu-version != '' && steps.config.outputs.opentofu-version != 'null' }}
89+
uses: opentofu/setup-opentofu@v1
90+
with:
91+
tofu_version: ${{ steps.config.outputs.opentofu-version }}
92+
tofu_wrapper: false
93+
94+
- name: Install Node
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: 20
98+
7899
- name: Filter Components
79100
id: selected-components
80101
shell: bash

0 commit comments

Comments
 (0)