Skip to content

Commit e5e47ed

Browse files
committed
Attempting template as action
1 parent b0866b7 commit e5e47ed

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed

.github/workflows/apply.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Apply - Terraform via ARC
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
10+
11+
jobs:
12+
deploy:
13+
runs-on: arc-dind
14+
container: image-registry.openshift-image-registry.svc:5000/arc-runners/terraform-runner:latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Run Git as root
20+
run: git config --global --add safe.directory '*'
21+
22+
- name: Install SSH key
23+
uses: shimataro/ssh-key-action@v2
24+
with:
25+
key: ${{ secrets.SSH_PRIVATE_KEY }}
26+
27+
- name: Terraform apply
28+
run: make apply

.github/workflows/plan.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Plan - Terraform via ARC
3+
4+
on:
5+
pull_request:
6+
types: [opened, reopened, synchronize]
7+
workflow_dispatch:
8+
9+
env:
10+
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
11+
12+
jobs:
13+
plan:
14+
runs-on: arc-dind
15+
container: image-registry.openshift-image-registry.svc:5000/arc-runners/terraform-runner:latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Run Git as root
21+
run: git config --global --add safe.directory '*'
22+
23+
- name: Install SSH key
24+
uses: shimataro/ssh-key-action@v2
25+
with:
26+
key: ${{ secrets.SSH_PRIVATE_KEY }}
27+
28+
- name: Run tests
29+
run: make test
30+
31+
- name: Terraform plan
32+
run: make plan

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ No modules.
2222
| Name | Type |
2323
|------|------|
2424
| [libvirt_domain.runner](https://registry.terraform.io/providers/dmacvicar/libvirt/0.7.1/docs/resources/domain) | resource |
25+
| [libvirt_domain.template-server](https://registry.terraform.io/providers/dmacvicar/libvirt/0.7.1/docs/resources/domain) | resource |
2526
| [libvirt_volume.runner](https://registry.terraform.io/providers/dmacvicar/libvirt/0.7.1/docs/resources/volume) | resource |
27+
| [libvirt_volume.template-server](https://registry.terraform.io/providers/dmacvicar/libvirt/0.7.1/docs/resources/volume) | resource |
2628
| [sops_file.secret_vars](https://registry.terraform.io/providers/carlpett/sops/latest/docs/data-sources/file) | data source |
2729

2830
## Inputs

template-server.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
resource "libvirt_volume" "template-server" {
2+
name = "template-server.qcow2"
3+
size = "21474836480" # 20 Gigabyte to byte
4+
}
5+
6+
resource "libvirt_domain" "template-server" {
7+
name = "template-server"
8+
description = "GitHub Actions self-hosted template-server"
9+
cpu {
10+
mode = "host-passthrough"
11+
}
12+
vcpu = "1"
13+
memory = "4096"
14+
disk {
15+
file = data.sops_file.secret_vars.data["fedora_server_path"]
16+
}
17+
disk {
18+
volume_id = libvirt_volume.template-server.id
19+
}
20+
network_interface {
21+
network_name = "default"
22+
}
23+
network_interface {
24+
network_name = "internal"
25+
}
26+
graphics {
27+
type = "vnc"
28+
listen_type = "none"
29+
}
30+
boot_device {
31+
dev = ["cdrom", "hd"]
32+
}
33+
depends_on = [libvirt_volume.template-server]
34+
}
35+

0 commit comments

Comments
 (0)