Added hetzner secret
This commit is contained in:
parent
dae33bedfc
commit
31e1f425e8
8 changed files with 82 additions and 7 deletions
|
@ -1,11 +1,19 @@
|
||||||
branches:
|
branches:
|
||||||
include: [main]
|
include: [ ]
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
init:
|
init:
|
||||||
image: hashicorp/terraform
|
image: hashicorp/terraform
|
||||||
environment:
|
environment:
|
||||||
- CODE_PATH=./hetzner/template
|
- CODE_PATH=./hetzner/Projects/Development/landing-zone
|
||||||
commands:
|
commands:
|
||||||
- apk add make
|
- apk add make
|
||||||
- make init
|
- make init
|
||||||
|
apply:
|
||||||
|
image: hashicorp/terraform
|
||||||
|
environment:
|
||||||
|
- CODE_PATH=./hetzner/Projects/Development/landing-zone
|
||||||
|
secrets: [hetznerkey]
|
||||||
|
commands:
|
||||||
|
- apk add make
|
||||||
|
- make apply
|
11
.woodpecker/destroy.yml
Normal file
11
.woodpecker/destroy.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
branches:
|
||||||
|
include: [ ]
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
init:
|
||||||
|
image: hashicorp/terraform
|
||||||
|
environment:
|
||||||
|
- CODE_PATH=./hetzner/template
|
||||||
|
commands:
|
||||||
|
- apk add make
|
||||||
|
- make destroy
|
12
Makefile
12
Makefile
|
@ -1,16 +1,17 @@
|
||||||
CODE_PATH ?= .
|
CODE_PATH ?= .
|
||||||
|
HETZNERKEY ?= .
|
||||||
|
|
||||||
init:
|
init:
|
||||||
@cd $(CODE_PATH) && terraform init -reconfigure -upgrade
|
@cd $(CODE_PATH) && terraform init -reconfigure -upgrade
|
||||||
|
|
||||||
plan: init validate
|
plan: init validate
|
||||||
@cd $(CODE_PATH) && terraform plan
|
@cd $(CODE_PATH) && terraform plan -var="hcloud_token=$(HETZNERKEY)"
|
||||||
|
|
||||||
apply: init validate
|
apply: init validate
|
||||||
@cd $(CODE_PATH) && terraform apply --auto-approve
|
@cd $(CODE_PATH) && terraform apply --auto-approve -var="hcloud_token=$(HETZNERKEY)"
|
||||||
|
|
||||||
refresh: init validate
|
refresh: init validate
|
||||||
@cd $(CODE_PATH) && terraform refresh
|
@cd $(CODE_PATH) && terraform refresh -var="hcloud_token=$(HETZNERKEY)"
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
@cd $(CODE_PATH) && terraform fmt -check -recursive
|
@cd $(CODE_PATH) && terraform fmt -check -recursive
|
||||||
|
@ -19,4 +20,7 @@ validate:
|
||||||
@cd $(CODE_PATH) && terraform validate
|
@cd $(CODE_PATH) && terraform validate
|
||||||
|
|
||||||
output: init
|
output: init
|
||||||
@cd $(CODE_PATH) && terraform output
|
@cd $(CODE_PATH) && terraform output
|
||||||
|
|
||||||
|
destroy: init validate
|
||||||
|
@cd $(CODE_PATH) && terraform destroy --auto-approve -var="hcloud_token=$(HETZNERKEY)"
|
|
@ -0,0 +1,24 @@
|
||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hetznercloud/hcloud" {
|
||||||
|
version = "1.36.1"
|
||||||
|
constraints = "~> 1.36.0"
|
||||||
|
hashes = [
|
||||||
|
"h1:xZSvxx6aUo0oZp2uqNxi/+wqnCNEBBuu8y7GeXIO9qA=",
|
||||||
|
"zh:16558b25c7f92f187278e94e951b0ab687882b06acff5b1387f3293f27939f8c",
|
||||||
|
"zh:28fc79ac2189ff0f5e6c9535ada8f57552b6e21c978b59dc78e086c27b9e4b23",
|
||||||
|
"zh:373907f9f7f2cefa94e2d5638bf5bef3d3b17e7655dc84dd6089346c6f4f9096",
|
||||||
|
"zh:394716cd877de682a0772d660f1bdb3838c5d751eca2211105d5ede248c48c39",
|
||||||
|
"zh:3c438c6590fcc8ac65a10039b2f5ba9ee379a734cb93a59c6cf74f385d891e87",
|
||||||
|
"zh:3f777a460a62fd23b283c269f1533b3887bf0c5564581e1e96cf294e077f5a8a",
|
||||||
|
"zh:4f62967553d7ce81ec14db7685306b625970ba6640b5764dc0137675ab97af0b",
|
||||||
|
"zh:56da08f8d75f596d6f9da4f0fd16bd60d1733cabcc260e885e1d7a711d6d3d8b",
|
||||||
|
"zh:62776c885bfa8e715dba6662f1744b5251f4cdd523dd4d1e4ccb2e25489593e9",
|
||||||
|
"zh:64cbb68139aa65f95ab3e654d872f9d34ef991fbf667fc30e0f29b96b5e8b4ed",
|
||||||
|
"zh:75a4b7a73ff0a537214d12d820438b7ae7a33d660e5d793f4ae0ebe3152bff00",
|
||||||
|
"zh:7b59d72538772ada7d51eaa50c905285200b1889ab29948b533412ccdf4d18de",
|
||||||
|
"zh:b84eeaa82bf765c6dd945ae83f1a9271fa5fad53b861b18b09cb8deda67dae13",
|
||||||
|
"zh:e81c3ea971e32a6ca3fdb0cd9e644614308ab2cf2a19482dd8a109d67fe3fb6f",
|
||||||
|
]
|
||||||
|
}
|
10
hetzner/Projects/Development/landing-zone/main.tf
Normal file
10
hetzner/Projects/Development/landing-zone/main.tf
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Create a new server running debian
|
||||||
|
resource "hcloud_server" "node1" {
|
||||||
|
name = "node1"
|
||||||
|
image = "debian-11"
|
||||||
|
server_type = "cx11"
|
||||||
|
public_net {
|
||||||
|
ipv4_enabled = true
|
||||||
|
ipv6_enabled = true
|
||||||
|
}
|
||||||
|
}
|
4
hetzner/Projects/Development/landing-zone/provider.tf
Normal file
4
hetzner/Projects/Development/landing-zone/provider.tf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Configure the Hetzner Cloud Provider
|
||||||
|
provider "hcloud" {
|
||||||
|
token = var.hcloud_token
|
||||||
|
}
|
5
hetzner/Projects/Development/landing-zone/variables.tf
Normal file
5
hetzner/Projects/Development/landing-zone/variables.tf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Set the variable value in *.tfvars file
|
||||||
|
# or using the -var="hcloud_token=..." CLI option
|
||||||
|
variable "hcloud_token" {
|
||||||
|
sensitive = true # Requires terraform >= 0.14
|
||||||
|
}
|
9
hetzner/Projects/Development/landing-zone/versions.tf
Normal file
9
hetzner/Projects/Development/landing-zone/versions.tf
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
hcloud = {
|
||||||
|
source = "hetznercloud/hcloud"
|
||||||
|
version = "~> 1.36.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
required_version = ">= 1.3.6"
|
||||||
|
}
|
Loading…
Reference in a new issue