Skip to content

Commit 6b016a1

Browse files
authored
Merge pull request #2 from kislerdm/main
Action v0.0.1
2 parents c1b3b23 + 35304a0 commit 6b016a1

25 files changed

+22588
-1
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Continuous Integration'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
check-dist:
11+
name: Check dist/ directory
12+
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@967035ce963867fb956a309c9b67512314bc7c1f
13+
with:
14+
node-version: "20.x"
15+
test:
16+
name: Test
17+
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@967035ce963867fb956a309c9b67512314bc7c1f
18+
with:
19+
node-version: "20.x"

.github/workflows/data/local/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
resource "terraform_data" "replacement" {
2+
triggers_replace = timestamp()
3+
}

.github/workflows/setup-tofu.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: 'Setup OpenTofu'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
tofu-versions:
15+
name: 'OpenTofu Versions'
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
tofu-versions: [1.6.0-alpha1, latest]
21+
tofu-wrapper: [true, false]
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup OpenTofu - ${{ matrix['tofu-versions'] }}
27+
uses: ./
28+
with:
29+
tofu_version: ${{ matrix['tofu-versions'] }}
30+
tofu_wrapper: ${{ matrix['tofu-wrapper'] }}
31+
32+
- name: Validate that OpenTofu was installed
33+
run: tofu version | grep 'OpenTofu v'
34+
35+
- name: Validate the Version ${{ matrix['tofu-versions'] }} was installed
36+
if: ${{ matrix['tofu-versions'] != 'latest' }}
37+
run: tofu version | grep ${{ matrix['tofu-versions']}}
38+
tofu-arguments:
39+
name: 'OpenTofu Arguments'
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
matrix:
43+
os: [ubuntu-latest, windows-latest, macos-latest]
44+
tofu-wrapper: [true, false]
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Setup OpenTofu
50+
uses: ./
51+
with:
52+
tofu_wrapper: ${{ matrix['tofu-wrapper'] }}
53+
54+
- name: Check No Arguments
55+
run: tofu || exit 0
56+
57+
- name: Check Single Argument
58+
run: tofu help || exit 0
59+
60+
- name: Check Single Argument Hyphen
61+
run: tofu -help
62+
63+
- name: Check Single Argument Double Hyphen
64+
run: tofu --help
65+
66+
- name: Check Single Argument Subcommand
67+
run: tofu fmt -check
68+
69+
- name: Check Multiple Arguments Subcommand
70+
run: tofu fmt -check -list=true -no-color
71+
tofu-run-local:
72+
name: 'OpenTofu Run Local'
73+
runs-on: ${{ matrix.os }}
74+
strategy:
75+
matrix:
76+
os: [ubuntu-latest, windows-latest, macos-latest]
77+
tofu-wrapper: [true, false]
78+
defaults:
79+
run:
80+
working-directory: ./.github/workflows/data/local
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
85+
- name: Setup OpenTofu
86+
uses: ./
87+
with:
88+
tofu_wrapper: ${{ matrix['tofu-wrapper'] }}
89+
90+
- name: OpenTofu Init
91+
run: tofu init
92+
93+
- name: OpenTofu Format
94+
run: tofu fmt -check
95+
96+
- name: OpenTofu Plan
97+
id: plan
98+
run: tofu plan
99+
100+
- name: Print OpenTofu Plan
101+
if: ${{ matrix['tofu-wrapper'] == 'true' }}
102+
run: echo "${{ steps.plan.outputs.stdout }}"
103+
tofu-credentials-cloud:
104+
name: 'OpenTofu Cloud Credentials'
105+
runs-on: ${{ matrix.os }}
106+
strategy:
107+
matrix:
108+
os: [ubuntu-latest, windows-latest, macos-latest]
109+
env:
110+
TF_CLOUD_API_TOKEN: 'XXXXXXXXXXXXXX.atlasv1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
111+
steps:
112+
- name: Checkout
113+
uses: actions/checkout@v4
114+
115+
- name: Setup OpenTofu
116+
uses: ./
117+
with:
118+
cli_config_credentials_token: ${{ env.TF_CLOUD_API_TOKEN }}
119+
120+
- name: Validate OpenTofu Credentials (Windows)
121+
if: runner.os == 'Windows'
122+
run: |
123+
cat ${APPDATA}/tofu.rc | grep 'credentials "app.terraform.io"'
124+
cat ${APPDATA}/tofu.rc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
125+
126+
- name: Validate Teraform Credentials (Linux & macOS)
127+
if: runner.os != 'Windows'
128+
run: |
129+
cat ${HOME}/.tofurc | grep 'credentials "app.terraform.io"'
130+
cat ${HOME}/.tofurc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
131+
132+
tofu-credentials-enterprise:
133+
name: 'OpenTofu Enterprise Credentials'
134+
runs-on: ${{ matrix.os }}
135+
strategy:
136+
matrix:
137+
os: [ubuntu-latest, windows-latest, macos-latest]
138+
env:
139+
TF_CLOUD_API_TOKEN: 'XXXXXXXXXXXXXX.atlasv1.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
140+
steps:
141+
- name: Checkout
142+
uses: actions/checkout@v4
143+
144+
- name: Setup OpenTofu
145+
uses: ./
146+
with:
147+
cli_config_credentials_hostname: 'tofu.example.com'
148+
cli_config_credentials_token: ${{ env.TF_CLOUD_API_TOKEN }}
149+
150+
- name: Validate OpenTofu Credentials (Windows)
151+
if: runner.os == 'Windows'
152+
run: |
153+
cat ${APPDATA}/tofu.rc | grep 'credentials "tofu.example.com"'
154+
cat ${APPDATA}/tofu.rc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
155+
156+
- name: Validate Teraform Credentials (Linux & macOS)
157+
if: runner.os != 'Windows'
158+
run: |
159+
cat ${HOME}/.tofurc | grep 'credentials "tofu.example.com"'
160+
cat ${HOME}/.tofurc | grep 'token = "${{ env.TF_CLOUD_API_TOKEN }}"'
161+
162+
tofu-credentials-none:
163+
name: 'OpenTofu No Credentials'
164+
runs-on: ${{ matrix.os }}
165+
strategy:
166+
matrix:
167+
os: [ubuntu-latest, windows-latest, macos-latest]
168+
steps:
169+
- name: Checkout
170+
uses: actions/checkout@v4
171+
172+
- name: Setup OpenTofu
173+
uses: ./
174+
175+
- name: Validate OpenTofu Credentials (Windows)
176+
if: runner.os == 'Windows'
177+
run: |
178+
[[ -f ${APPDATA}/tofu.rc ]] || exit 0
179+
180+
- name: Validate Teraform Credentials (Linux & macOS)
181+
if: runner.os != 'Windows'
182+
run: |
183+
[[ -f ${HOME}/.tofurc ]] || exit 0
184+

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
node_modules/
2+
3+
# Editors
4+
.vscode
5+
.idea/
6+
.iml
7+
8+
# Logs
9+
*.log
10+
npm-debug.log*
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
24+
# nyc test coverage
25+
.nyc_output
26+
27+
# node-waf configuration
28+
.lock-wscript
29+
30+
# Other Dependency directories
31+
jspm_packages/
32+
33+
# Optional npm cache directory
34+
.npm
35+
36+
# Optional eslint cache
37+
.eslintcache
38+
39+
# Optional REPL history
40+
.node_repl_history
41+
42+
# Output of 'npm pack'
43+
*.tgz
44+
45+
# Yarn Integrity file
46+
.yarn-integrity
47+
48+
# dotenv environment variables file
49+
.env
50+
51+
# ./wrapper/dist gets included in top-level ./dist
52+
wrapper/dist

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run lint || (npm install && npm run lint)
5+
npm run test
6+
npm audit --audit-level=high
7+
npm run build && git add dist/

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Unreleased
2+
3+
Initial release. It provides feature parity with the [setup-terraform](https://github.com/hashicorp/setup-terraform) action.

CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Each line is a file pattern followed by one or more owners.
2+
# More on CODEOWNERS files: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
3+
4+
# We currently do not have any specific code owners
5+
# In the future, we will have a Github team of global code owners of the entire package
6+
# Later on, we will start splitting up the responsibilities, and packages will be assigned more specific code owners
7+
# * @opentofu-code-owners

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Code of Conduct
2+
3+
We follow the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
4+
5+
<!-- TODO: Decide who will handle Code of Conduct reports and replace [INSERT EMAIL ADDRESS]
6+
with an email address in the paragraph below. We recommend using a mailing list to handle reports.
7+
If your project isn't prepared to handle reports, remove the project email address and just have
8+
reporters send to [email protected].
9+
-->
10+
Please contact [email protected] in order to report violations of the Code of Conduct.

0 commit comments

Comments
 (0)