Skip to content

Commit f5b47ed

Browse files
committed
chore: initial terraform-provider-pwpush
0 parents  commit f5b47ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1994
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# .devcontainer/Dockerfile
2+
FROM mcr.microsoft.com/devcontainers/go:1.21
3+
4+
RUN apt-get update && apt-get install -y unzip curl make git

.devcontainer/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# 🚀 Terraform Provider for Password Pusher
2+
3+
This repository contains a custom [Terraform](https://www.terraform.io/) provider for managing [Password Pusher](https://pwpush.com/). It includes a full development environment using [VS Code Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) for easy local development and testing.
4+
5+
---
6+
7+
## 🐳 Dev Container Support
8+
9+
This repository includes a `.devcontainer` setup based on Docker-in-Docker (DinD), enabling you to develop and test the provider in an isolated environment without requiring Docker access on the host system.
10+
11+
### ✅ Prerequisites
12+
13+
- [Docker](https://www.docker.com/get-started) installed on your host machine
14+
- [Visual Studio Code](https://code.visualstudio.com/)
15+
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
16+
17+
> **Note:** The setup uses Docker-in-Docker with `--privileged` mode. You **don't need to mount your host Docker socket**.
18+
19+
---
20+
21+
### 🚀 Getting Started Locally
22+
23+
1. Clone this repository
24+
2. Open the repo in **VS Code**
25+
3. If prompted, install the **Dev Containers** extension
26+
4. Click **"Reopen in Container"** when prompted
27+
Or use the Command Palette: `Dev Containers: Reopen in Container`
28+
5. The container will build and automatically run:
29+
30+
```bash
31+
make up
32+
```
33+
6. In folder e2e-test you may tested pwpush terraform provider.
34+
35+
### 🚀 Getting Started in GitHub
36+
37+
1. Click on **<> Code** -> **Codespace** -> **Create codespace on main**
38+
2. GitHub open the repo in online **VS Code** loaded repository and run:
39+
40+
```bash
41+
make up
42+
```
43+
3. In folder e2e-test you may tested pwpush terraform provider.

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "Password Pusher Dev Environment",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"forwardPorts": [5100],
7+
"postCreateCommand": "make up",
8+
"features": {
9+
"ghcr.io/devcontainers/features/go:1": {
10+
"version": "1.21"
11+
},
12+
"ghcr.io/devcontainers/features/terraform:1": {
13+
"version": "1.6.6"
14+
},
15+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
16+
"version": "latest"
17+
}
18+
},
19+
"runArgs": [
20+
"--privileged"
21+
],
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"golang.Go",
26+
"hashicorp.terraform",
27+
"esbenp.prettier-vscode"
28+
]
29+
}
30+
},
31+
"remoteUser": "vscode"
32+
}

.github/CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Contributing to this Provider
2+
3+
Thank you so much for considering to contribute!
4+
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
5+
1. Fork the Project
6+
2. Create your Feature Branch (`git checkout -b feature/TerraformFeature`)
7+
3. Commit your Changes (`git commit -m 'Add some TerraformFeature'`)
8+
4. Push to the Branch (`git push origin feature/TerraformFeature`)
9+
5. Open a [Pull Request](https://github.com/grulicht/terraform-provider-pwpush/pulls)
10+
11+
### Merging
12+
13+
1. As soon as possible the authors will review your pull request, answering to your message.
14+
2. **ALL CI tests** must be passed. <span style="color: #008000;">&#10004;</span>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Close stale issues and pull requests"
2+
on:
3+
schedule:
4+
- cron: "0 14 * * *"
5+
6+
jobs:
7+
stale:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/stale@v9
11+
with:
12+
days-before-issue-stale: 30
13+
stale-issue-message: "This issue has been automatically marked as stale due to inactivity. It will be closed in 7 days if no further activity occurs. Please comment or remove the stale label to keep it open."
14+
days-before-issue-close: 7
15+
close-issue-message: "This issue has been closed due to prolonged inactivity. Feel free to reopen if you need more information or further assistance."
16+
stale-issue-label: "stale"
17+
days-before-pr-stale: 60
18+
stale-pr-message: "This pull request has been marked as stale due to inactivity. It will be closed in 7 days if no further activity occurs. Please comment or remove the stale label to keep it open."
19+
days-before-pr-close: 7
20+
close-pr-message: "This pull request has been closed due to prolonged inactivity. Feel free to reopen if you plan to continue your work."
21+
stale-pr-label: "stale"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Daily E2E Tests
2+
3+
on:
4+
schedule:
5+
- cron: "0 7 * * *" # Every day at 07:00 UTC
6+
workflow_dispatch: # Allow manual trigger
7+
8+
jobs:
9+
e2e:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: ⬇️ Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: 🐳 Start Pwpush via Docker Compose
17+
run: make up
18+
19+
- name: ⬇️ Install Terraform
20+
uses: hashicorp/setup-terraform@v3
21+
with:
22+
terraform_version: 1.6.6
23+
24+
- name: 🔍 Validate formatting (terraform fmt)
25+
run: terraform fmt -check -recursive
26+
27+
- name: 🧪 Run Terraform E2E tests
28+
run: |
29+
FULL_CYCLE_DIRS=("push-qr" "push-string" "push-url")
30+
31+
for dir in "${FULL_CYCLE_DIRS[@]}"; do
32+
if [ -d "e2e-tests/$dir" ]; then
33+
echo "▶️ Running full Terraform cycle in e2e-tests/$dir"
34+
cd "e2e-tests/$dir"
35+
terraform init -input=false
36+
terraform fmt -check
37+
terraform validate
38+
terraform apply -auto-approve
39+
terraform destroy -auto-approve
40+
cd -
41+
fi
42+
done

.github/workflows/docs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docs CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
jobs:
10+
mdvalidate:
11+
name: Validate Markdown Files
12+
runs-on: ubuntu-latest
13+
env:
14+
GOARCH: amd64
15+
GOOS: linux
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 1
21+
22+
- name: Markdown Link Validation
23+
uses: gaurav-nelson/github-action-markdown-link-check@v1

.github/workflows/go.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Golang CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
go-lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
14+
# v4.2.2
15+
with:
16+
persist-credentials: false
17+
18+
- name: Setup Go
19+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b
20+
# v5.4.0
21+
with:
22+
go-version-file: go.mod
23+
cache-dependency-path: go.sum
24+
25+
- name: Run Go format check via Makefile
26+
run: make go-fmt-check

.github/workflows/opentofu.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: OpenTofu CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
opentofu:
15+
name: OpenTofu Validation
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install OpenTofu
23+
uses: opentofu/setup-opentofu@v1
24+
with:
25+
tofu_version: latest
26+
27+
- name: Show OpenTofu version
28+
run: tofu version
29+
30+
- name: Initialize OpenTofu
31+
run: make o-init
32+
33+
- name: Validate OpenTofu configuration
34+
run: make o-validate
35+
36+
- name: Check OpenTofu formatting
37+
run: make o-fmt-check

.github/workflows/pr-e2e-test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PR E2E Tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
e2e-pr:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: ⬇️ Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: ⚙️ Build local provider
15+
run: make build
16+
17+
- name: 🧩 Install local provider plugin
18+
run: make install-plugin
19+
20+
- name: 🩹 Patch main.tf files to use local provider
21+
run: |
22+
find e2e-tests -name "main.tf" -exec sed -i 's|source *= *"grulicht/pwpush"|source = "localdomain/local/pwpush"|' {} +
23+
24+
- name: 🐳 Start Pwpush via Docker Compose
25+
run: make up
26+
27+
- name: ⬇️ Install Terraform
28+
uses: hashicorp/setup-terraform@v3
29+
with:
30+
terraform_version: 1.6.6
31+
32+
- name: 🔍 Validate formatting (terraform fmt)
33+
run: terraform fmt -check -recursive
34+
35+
- name: 🧪 Run Terraform E2E tests
36+
run: |
37+
FULL_CYCLE_DIRS=("push-qr" "push-string" "push-url")
38+
39+
for dir in "${FULL_CYCLE_DIRS[@]}"; do
40+
if [ -d "e2e-tests/$dir" ]; then
41+
echo "▶️ Running full Terraform cycle in e2e-tests/$dir"
42+
cd "e2e-tests/$dir"
43+
terraform init -input=false
44+
terraform fmt -check
45+
terraform validate
46+
terraform apply -auto-approve
47+
terraform destroy -auto-approve
48+
cd -
49+
fi
50+
done

0 commit comments

Comments
 (0)