Initial commit
Some checks failed
CI / Terraform Format & Validate (push) Failing after 40s
CI / TruffleHog Secrets Scan (push) Has been cancelled

This commit is contained in:
Mauritz Uphoff 2025-05-06 22:17:54 +02:00
commit a6d3c9b75f
7 changed files with 143 additions and 0 deletions

View file

@ -0,0 +1,28 @@
name: CI
on: [push]
jobs:
secrets-scan:
name: TruffleHog Secrets Scan
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: trufflehog-actions-scan
uses: https://github.com/edplato/trufflehog-actions-scan@master
terraform:
name: Terraform Format & Validate
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: https://github.com/hashicorp/setup-terraform@v3
with:
terraform_version: "1.5.7"
- name: Format Terraform Code
run: terraform fmt -recursive -check

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
.idea
keys/*
.terraform
*.tfstate
terraform.tfstate
terraform.tfstate.backup
.DS_Store

25
.terraform.lock.hcl Normal file
View file

@ -0,0 +1,25 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/stackitcloud/stackit" {
version = "0.51.0"
constraints = "> 0.35.0"
hashes = [
"h1:xEq9g1RuX4WIA3KNHyYgnBfWwY7mNn3yQGlFn/WbX9o=",
"zh:0dde99e7b343fa01f8eefc378171fb8621bedb20f59157d6cc8e3d46c738105f",
"zh:2d920411cbf4976d0fdf0d0d3f0403929b0c1e21ca3c3aa09031651b8bd1f614",
"zh:4067b3b21b50d55485edda9da11fd0df4188a05e02c3bc9332ad24f6a5c977e8",
"zh:46e25c4058e5ff5b321e2f3c23521acba4722b626cb427ed17f970515e3efb8c",
"zh:4bbe1904333a5dc00584915b94271e8482ca06586de4f345d3b1f019057d5dff",
"zh:7480e6d7deb519fc15f28156fe09b201f73c0654944526ac3da3510c902feaa9",
"zh:7868dd37c44423a9bb5b5fbd883171d2c36fd4507f7545de355caffbf20c2b99",
"zh:a5b47602355cb1611673fcb26f972529f5d6fe0e11a47b1b916e610ecb10fc86",
"zh:aefa5b9a0eefecac09e10c8c4d0ff2109b9a9eabd163fa34b48116f7a205b66f",
"zh:c6a5b0737198add8bed3affc072b09ee87f928c4c25437fe1a5871b6d454c879",
"zh:d07dcbc92463ebe2f28f9125b74e362ccf32f4d5bc71ee339c6d28dce7229a8d",
"zh:d63dd003fbe2752694d70e1accce9bb8d118e6332ac7a08a844109b93c98e8f2",
"zh:f32ebcb26ae57d7c7480e07b5a42eec57ee410097072c216485ceca3254a98f2",
"zh:f3b78e090125cb02136677cc7faf5a3a317a620132c0211bfd6fe63e66de2807",
"zh:f5db68035985aba0b6a8b66da7b653dbb02b4dcc8f0f8efc6ff243b7bad16d99",
]
}

1
000-backend.tf Normal file
View file

@ -0,0 +1 @@
terraform {}

8
010-provider.tf Normal file
View file

@ -0,0 +1,8 @@
terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = ">0.35.0"
}
}
}

14
020-variables.tf Normal file
View file

@ -0,0 +1,14 @@
variable "stackit_project_id" {
type = string
default = "XXXXX-XXXX-XXXX-XXXX-XXXXXXX"
}
variable "stackit_region" {
type = string
default = "eu01"
}
variable "stackit_service_account_key_path" {
type = string
default = "./keys/stackit-sa.json"
}

60
030-server.tf Normal file
View file

@ -0,0 +1,60 @@
provider "stackit" {
region = var.stackit_region
service_account_key_path = var.stackit_service_account_key_path
}
resource "stackit_key_pair" "example_keypair" {
name = "example-keypair"
public_key = chomp(file("~/.ssh/id_rsa.pub"))
}
resource "stackit_volume" "example_volume" {
project_id = var.stackit_project_id
size = 72
source = {
type = "image"
// ubuntu 24.04
id = "a2c127b2-b1b5-4aee-986f-41cd11b41279"
}
performance_class = "storage_premium_perf12"
name = "example-volume"
availability_zone = "eu01-m"
}
resource "stackit_network_interface" "example_nic" {
project_id = var.stackit_project_id
network_id = stackit_network.example_network.network_id
security = false
}
resource "stackit_server" "example_server" {
project_id = var.stackit_project_id
name = "example-server"
boot_volume = {
source_type = "volume"
source_id = stackit_volume.example_volume.volume_id
}
availability_zone = "eu01-m"
// change on the machine type does not affect the underlying volume
machine_type = "g1.4"
keypair_name = stackit_key_pair.example_keypair.name
network_interfaces = [
stackit_network_interface.example_nic.network_interface_id
]
}
resource "stackit_network" "example_network" {
project_id = var.stackit_project_id
name = "example-network"
ipv4_prefix_length = 24
ipv4_nameservers = ["1.1.1.1", "8.8.8.8"]
}
resource "stackit_public_ip" "example_public_ip" {
project_id = var.stackit_project_id
network_interface_id = stackit_network_interface.example_nic.network_interface_id
}
output "public_ip" {
value = stackit_public_ip.example_public_ip.ip
}