mirror of
https://github.com/apricote/home-cloud.git
synced 2026-02-07 02:07:02 +00:00
bitwarden deployment
This commit is contained in:
commit
42ec743a00
24 changed files with 498 additions and 0 deletions
4
modules/floating_ip/files/99-floating.cfg
Executable file
4
modules/floating_ip/files/99-floating.cfg
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
auto eth0:1
|
||||
iface eth0:1 inet static
|
||||
address ${FLOATING_IP}
|
||||
netmask 255.255.255.255
|
||||
48
modules/floating_ip/main.tf
Executable file
48
modules/floating_ip/main.tf
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#################
|
||||
### IP ADDRESS ##
|
||||
#################
|
||||
|
||||
resource hcloud_floating_ip main {
|
||||
type = "${var.type}"
|
||||
description = "${var.host}"
|
||||
home_location = "${var.location}"
|
||||
}
|
||||
|
||||
resource "hcloud_rdns" "main" {
|
||||
floating_ip_id = "${hcloud_floating_ip.main.id}"
|
||||
ip_address = "${hcloud_floating_ip.main.ip_address}"
|
||||
dns_ptr = "${var.host}"
|
||||
}
|
||||
|
||||
###################################
|
||||
### ASSIGNMENT AND PROVISIONING ###
|
||||
###################################
|
||||
|
||||
data "template_file" "network_config" {
|
||||
template = "${file("modules/floating_ip/files/99-floating.cfg")}"
|
||||
|
||||
vars {
|
||||
FLOATING_IP = "${hcloud_floating_ip.main.ip_address}"
|
||||
}
|
||||
}
|
||||
|
||||
resource hcloud_floating_ip_assignment main {
|
||||
floating_ip_id = "${hcloud_floating_ip.main.id}"
|
||||
server_id = "${var.server_id}"
|
||||
|
||||
connection = {
|
||||
host = "${var.server_ip}"
|
||||
private_key = "${file("keys/id_terraform")}"
|
||||
}
|
||||
|
||||
provisioner file {
|
||||
content = "${data.template_file.network_config.rendered}"
|
||||
destination = "/etc/network/interfaces.d/99-floating.cfg"
|
||||
}
|
||||
|
||||
provisioner remote-exec {
|
||||
inline = [
|
||||
"ifdown eth0:1 ; ifup eth0:1",
|
||||
]
|
||||
}
|
||||
}
|
||||
3
modules/floating_ip/outputs.tf
Executable file
3
modules/floating_ip/outputs.tf
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
output ip {
|
||||
value = "${hcloud_floating_ip.main.ip_address}"
|
||||
}
|
||||
21
modules/floating_ip/vars.tf
Executable file
21
modules/floating_ip/vars.tf
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
variable host {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable type {
|
||||
type = "string"
|
||||
default = "ipv4"
|
||||
}
|
||||
|
||||
variable server_id {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable server_ip {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable location {
|
||||
type = "string"
|
||||
default = "nbg1"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue