feat(infra): add nginx node, random password, null_resource automation, and outputs
This commit is contained in:
+84
-20
@@ -7,12 +7,12 @@ resource "gridscale_network" "network_internal"{
|
||||
dhcp_reserved_subnet = ["192.168.121.0/31"]
|
||||
}
|
||||
|
||||
resource "gridscale_ipv4" "public_ipv4" {
|
||||
name = "public_ipv4"
|
||||
resource "gridscale_ipv4" "public_ipv4_caddy" {
|
||||
name = "public_ipv4_caddy"
|
||||
}
|
||||
|
||||
resource "gridscale_ipv6" "public_ipv6" {
|
||||
name = "public_ipv6"
|
||||
resource "gridscale_ipv6" "public_ipv6_caddy" {
|
||||
name = "public_ipv6_caddy"
|
||||
}
|
||||
|
||||
resource "gridscale_ipv4" "public_ipv4_monitoring" {
|
||||
@@ -23,6 +23,14 @@ resource "gridscale_ipv6" "public_ipv6_monitoring" {
|
||||
name = "public_ipv6_monitoring"
|
||||
}
|
||||
|
||||
resource "gridscale_ipv4" "public_ipv4_nginx" {
|
||||
name = "public_ipv4_nginx"
|
||||
}
|
||||
|
||||
resource "gridscale_ipv6" "public_ipv6_nginx" {
|
||||
name = "public_ipv6_nginx"
|
||||
}
|
||||
|
||||
data "gridscale_template" "template_debian_13" {
|
||||
name = "Debian 13"
|
||||
}
|
||||
@@ -68,6 +76,13 @@ resource "gridscale_server" "server_caddy" {
|
||||
dst_port = 80
|
||||
comment = "Allow HTTP access"
|
||||
}
|
||||
rules_v4_in {
|
||||
order = 15
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 443
|
||||
comment = "Allow HTTPS access"
|
||||
}
|
||||
rules_v6_in {
|
||||
order = 0
|
||||
protocol = "tcp"
|
||||
@@ -82,6 +97,13 @@ resource "gridscale_server" "server_caddy" {
|
||||
dst_port = 80
|
||||
comment = "Allow HTTPv6 access"
|
||||
}
|
||||
rules_v6_in {
|
||||
order = 15
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 443
|
||||
comment = "Allow HTTPSv6 access"
|
||||
}
|
||||
}
|
||||
network {
|
||||
# Private network
|
||||
@@ -95,8 +117,8 @@ resource "gridscale_server" "server_caddy" {
|
||||
src_cidr = "192.168.121.0/27"
|
||||
}
|
||||
}
|
||||
ipv4 = gridscale_ipv4.public_ipv4.id
|
||||
ipv6 = gridscale_ipv6.public_ipv6.id
|
||||
ipv4 = gridscale_ipv4.public_ipv4_caddy.id
|
||||
ipv6 = gridscale_ipv6.public_ipv6_caddy.id
|
||||
timeouts {
|
||||
create = "10m"
|
||||
}
|
||||
@@ -131,13 +153,6 @@ resource "gridscale_server" "server_monitoring" {
|
||||
dst_port = 22
|
||||
comment = "Allow SSH access"
|
||||
}
|
||||
rules_v4_in {
|
||||
order = 10
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 80
|
||||
comment = "Allow HTTP access"
|
||||
}
|
||||
rules_v6_in {
|
||||
order = 0
|
||||
protocol = "tcp"
|
||||
@@ -145,13 +160,6 @@ resource "gridscale_server" "server_monitoring" {
|
||||
dst_port = 22
|
||||
comment = "Allow SSHv6 access"
|
||||
}
|
||||
rules_v6_in {
|
||||
order = 10
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 80
|
||||
comment = "Allow HTTPv6 access"
|
||||
}
|
||||
}
|
||||
network {
|
||||
# Private Network
|
||||
@@ -162,4 +170,60 @@ resource "gridscale_server" "server_monitoring" {
|
||||
timeouts {
|
||||
create = "10m"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resource "gridscale_storage" "storage_nginx" {
|
||||
name = "storage_nginx"
|
||||
storage_type = "storage"
|
||||
capacity = 20
|
||||
template {
|
||||
sshkeys = [gridscale_sshkey.sshkey_richard.id]
|
||||
template_uuid = data.gridscale_template.template_debian_13.id
|
||||
hostname = var.nginx_hostname
|
||||
}
|
||||
}
|
||||
|
||||
resource "gridscale_server" "server_nginx" {
|
||||
name = var.nginx_hostname
|
||||
cores = 2
|
||||
memory = 1
|
||||
power = true
|
||||
storage {
|
||||
object_uuid = gridscale_storage.storage_nginx.id
|
||||
}
|
||||
network {
|
||||
# Public Network
|
||||
object_uuid = "5557a73b-31ee-4b1f-aa15-7789ad6ae04c"
|
||||
rules_v4_in {
|
||||
order = 0
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 22
|
||||
comment = "Allow SSH access"
|
||||
}
|
||||
rules_v6_in {
|
||||
order = 0
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 22
|
||||
comment = "Allow SSHv6 access"
|
||||
}
|
||||
}
|
||||
network {
|
||||
# Private Network
|
||||
object_uuid = gridscale_network.network_internal.id
|
||||
rules_v4_in {
|
||||
order = 10
|
||||
protocol = "tcp"
|
||||
action = "accept"
|
||||
dst_port = 80
|
||||
comment = "Allow HTTP access for Loadbalancer"
|
||||
}
|
||||
}
|
||||
ipv4 = gridscale_ipv4.public_ipv4_nginx.id
|
||||
ipv6 = gridscale_ipv6.public_ipv6_nginx.id
|
||||
timeouts {
|
||||
create = "10m"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user