Browse Source

added hetzner sample with 2 balancers, 2 floating IPs, 4 backend nodes and SSH key

master
Vladimir Smagin 7 months ago
parent
commit
28e122b698

+ 16
- 0
hetzner-2-balancers-4-nodes/balancers.tf View File

@@ -0,0 +1,16 @@
1
+resource "hcloud_server" "balancer0" {
2
+  name = "balancer0"
3
+  image = "ubuntu-18.04"
4
+  server_type = "cx51"
5
+  ssh_keys = [ "${hcloud_ssh_key.masterkey.id}" ]
6
+  datacenter = "fsn1-dc8"
7
+}
8
+
9
+resource "hcloud_server" "balancer1" {
10
+  name = "balancer1"
11
+  image = "ubuntu-18.04"
12
+  server_type = "cx51"
13
+  ssh_keys = [ "${hcloud_ssh_key.masterkey.id}" ]
14
+  datacenter = "fsn1-dc8"
15
+}
16
+

+ 17
- 0
hetzner-2-balancers-4-nodes/floating_IPs.tf View File

@@ -0,0 +1,17 @@
1
+resource "hcloud_floating_ip" "balancer0" {
2
+  type = "ipv4"
3
+  home_location = "fsn1"
4
+  description = "balancer0"
5
+  lifecycle {
6
+    prevent_destroy = true
7
+  }
8
+}
9
+
10
+resource "hcloud_floating_ip" "balancer1" {
11
+  type = "ipv4"
12
+  home_location = "fsn1"
13
+  description = "balancer1"
14
+  lifecycle {
15
+    prevent_destroy = true
16
+  }
17
+}

+ 9
- 0
hetzner-2-balancers-4-nodes/floating_IPs_assign.tf View File

@@ -0,0 +1,9 @@
1
+resource "hcloud_floating_ip_assignment" "IPassign0" {
2
+  floating_ip_id = "${hcloud_floating_ip.balancer0.id}"
3
+  server_id = "${hcloud_server.balancer0.id}"
4
+}
5
+
6
+resource "hcloud_floating_ip_assignment" "IPassign1" {
7
+  floating_ip_id = "${hcloud_floating_ip.balancer1.id}"
8
+  server_id = "${hcloud_server.balancer1.id}"
9
+}

+ 31
- 0
hetzner-2-balancers-4-nodes/nodes.tf View File

@@ -0,0 +1,31 @@
1
+resource "hcloud_server" "node0" {
2
+  name = "node0"
3
+  image = "ubuntu-18.04"
4
+  server_type = "cx51"
5
+  ssh_keys = [ "${hcloud_ssh_key.masterkey.id}" ]
6
+  datacenter = "fsn1-dc8"
7
+}
8
+
9
+resource "hcloud_server" "node1" {
10
+  name = "node1"
11
+  image = "ubuntu-18.04"
12
+  server_type = "cx51"
13
+  ssh_keys = [ "${hcloud_ssh_key.masterkey.id}" ]
14
+  datacenter = "fsn1-dc8"
15
+}
16
+
17
+resource "hcloud_server" "node2" {
18
+  name = "node2"
19
+  image = "ubuntu-18.04"
20
+  server_type = "cx51"
21
+  ssh_keys = [ "${hcloud_ssh_key.masterkey.id}" ]
22
+  datacenter = "fsn1-dc8"
23
+}
24
+
25
+resource "hcloud_server" "node3" {
26
+  name = "node3"
27
+  image = "ubuntu-18.04"
28
+  server_type = "cx51"
29
+  ssh_keys = [ "${hcloud_ssh_key.masterkey.id}" ]
30
+  datacenter = "fsn1-dc8"
31
+}

+ 14
- 0
hetzner-2-balancers-4-nodes/project.tf View File

@@ -0,0 +1,14 @@
1
+variable "hcloud_token" {
2
+    type = "string"
3
+    default = "arObmfdkjldfksjfKJHKLSJDHFLKJHSDKFJHfjdhsfjkdhfLJKHKJHDLf453444"
4
+}
5
+
6
+provider "hcloud" {
7
+  token = "${var.hcloud_token}"
8
+}
9
+
10
+resource "hcloud_ssh_key" "masterkey" {
11
+  name = "Master Key"
12
+  public_key = "${file("secrets/master.key.pub")}"
13
+}
14
+

+ 27
- 0
hetzner-2-balancers-4-nodes/secrets/master.key View File

@@ -0,0 +1,27 @@
1
+-----BEGIN RSA PRIVATE KEY-----
2
+MIIEpAIBAAKCAQEAxBEY3WzMAzQ/yFWKNAiqXXleS/EkAVKOD4dCdSTZVcy8Qw8z
3
+ev5FP8gbKmUvAvd8RpWW5CGO86q0mKJjKZDhMcl1AKadDwkY8P0zOerTtZI88dqX
4
+dxr/ylr791DL6DuWHNnElhSLLfvfPRQZGLwIc0U/XwyYsJCBkLjp4IQWWWMpaK3P
5
+7ckm/VQeXNfURL3N6KMFzid9zdibVjc6dvi5IezOyPBkbVT+epKRY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Z7B7u7efRWYDPR3PzmmUw7R
22
+cc073Iw8Oj+v6DqYN8M1cqu/W3+VDmagRtH7yOWqJ9RXhJwsI0EJXzJ9nzlhfqk4
23
+0yV+EmHYO/uyGS8pyN4ltlj/a3vKVnllt58LLHNcjJIdgHpZwMXYVbViEFqhT+nX
24
+ms/1iwKBgQCgOwZ/yCN9v7ZlFIR/361zZXcFR1dM5yTC8KipFa3VpaLGiYRZPVCB
25
+9tNMoBACwNKnyJgGeZAXq9enLtXhG/sZBzVOz7e2eKCloaHfnLIKImmThRIwJpb0
26
+InQPM/ZLBIBhPoYPyRa0Cx5ABt9kmCQrIzpWQkpRZoAGhz8KiSYFLg==
27
+-----END RSA PRIVATE KEY-----

+ 1
- 0
hetzner-2-balancers-4-nodes/secrets/master.key.pub View File

@@ -0,0 +1 @@
1
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEERjdbMwDND/IVYo0CKpdeV5L8SQBUo4Ph0J1JNlVzLxDDzN6/kU/yBsqZS8C93xGlZbkIY7zqrSYomMpkOExyXUApp0PCRjw/TM56tO1kjzx2pd3Gv/KWvv3UMvoO5Yc2cSWFIst+989FBkYvAhzRT9fDJiwkIGQuOnghBZZYylorc/tySb9VB5c19REvc3oowXOJ33N2JtWNzp2+Lkh7M7I8GRtVP56kpFh2lbErdVzm2zuQGG+AAbCMiM1VtwOdjdaI2Cw12LsNvD3ORjAGgrnQ4337rtiKHyDFjdjkW75pB8+tSvRLUZFS91oTR8SZlT77nMMSikzSRyyOmOL masterkey

wordpress/docker.tf → wordpress-in-docker-containers/docker.tf View File


wordpress/images.tf → wordpress-in-docker-containers/images.tf View File


wordpress/network.tf → wordpress-in-docker-containers/network.tf View File


Loading…
Cancel
Save