Skip to content

Commit aefa639

Browse files
fix: terraform formatting
1 parent fff6e1f commit aefa639

2 files changed

Lines changed: 88 additions & 88 deletions

File tree

servers.tf

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
locals {
2-
fill_char_length = 64-length("github-runner")-4
2+
fill_char_length = 64 - length("github-runner") - 4
33
}
44

55
resource "random_string" "hetzner_machine" {
6-
length = local.fill_char_length > 0 ? local.fill_char_length : 0
7-
special = false
6+
length = local.fill_char_length > 0 ? local.fill_char_length : 0
7+
special = false
88
}
99

1010
resource "hcloud_server" "github_runner" {
@@ -33,42 +33,42 @@ resource "hcloud_server" "github_runner" {
3333

3434
provisioner "remote-exec" {
3535
inline = [
36-
"apt-get update -y",
37-
"DEBIAN_FRONTEND=noninteractive apt-get upgrade -y",
38-
"DEBIAN_FRONTEND=noninteractive apt-get install sudo git vim tmux apt-transport-https ca-certificates curl gnupg lsb-release pass ${var.hetzner_machine_additional_packages} -y",
39-
"echo '127.0.0.1 fylr-server-postgres fylr-server-sqlite execserver minio2 postgres2 elasticsearch2' >> /etc/hosts",
40-
"curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg",
41-
"echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null",
42-
"apt-get update -y",
43-
"apt-get install docker-ce docker-ce-cli containerd.io docker-compose -y",
44-
"curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -",
45-
"apt install nodejs",
46-
"mkdir /srv/actions-runner && cd /srv/actions-runner",
47-
"curl -o actions-runner-linux-x64-2.277.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.277.1/actions-runner-linux-x64-2.277.1.tar.gz",
48-
"tar xzf ./actions-runner-linux-x64-2.277.1.tar.gz",
49-
"adduser github-runner --disabled-login --gecos ''",
50-
"usermod -aG docker github-runner",
51-
"echo 'github-runner ALL=(ALL:ALL)NOPASSWD:ALL' > /etc/sudoers.d/github-runner",
52-
"chown -R github-runner /srv",
53-
"chmod +x /srv/setup-runner.sh /srv/gh-runner-cli",
54-
"mv /srv/actions-runner/run.sh /srv/actions-runner/run.sh.old",
55-
"su github-runner -c 'export CUSTOM_HOSTNAME=${self.name}; export GH_USERNAME=${var.github_authentication_user}; export GH_TOKEN=${var.github_authentication_token}; export GH_OWNER=${var.github_owner}; export GH_NAME=${var.github_repository_name}; export GH_LABELS=${var.github_actions_runner_labels}; export GH_REPLACE_RUNNERS=${var.github_actions_runner_replace_existing}; export GH_RUNNER_TYPE=${var.github_runner_type}; /srv/setup-runner.sh'"
56-
]
36+
"apt-get update -y",
37+
"DEBIAN_FRONTEND=noninteractive apt-get upgrade -y",
38+
"DEBIAN_FRONTEND=noninteractive apt-get install sudo git vim tmux apt-transport-https ca-certificates curl gnupg lsb-release pass ${var.hetzner_machine_additional_packages} -y",
39+
"echo '127.0.0.1 fylr-server-postgres fylr-server-sqlite execserver minio2 postgres2 elasticsearch2' >> /etc/hosts",
40+
"curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg",
41+
"echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable' | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null",
42+
"apt-get update -y",
43+
"apt-get install docker-ce docker-ce-cli containerd.io docker-compose -y",
44+
"curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -",
45+
"apt install nodejs",
46+
"mkdir /srv/actions-runner && cd /srv/actions-runner",
47+
"curl -o actions-runner-linux-x64-2.277.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.277.1/actions-runner-linux-x64-2.277.1.tar.gz",
48+
"tar xzf ./actions-runner-linux-x64-2.277.1.tar.gz",
49+
"adduser github-runner --disabled-login --gecos ''",
50+
"usermod -aG docker github-runner",
51+
"echo 'github-runner ALL=(ALL:ALL)NOPASSWD:ALL' > /etc/sudoers.d/github-runner",
52+
"chown -R github-runner /srv",
53+
"chmod +x /srv/setup-runner.sh /srv/gh-runner-cli",
54+
"mv /srv/actions-runner/run.sh /srv/actions-runner/run.sh.old",
55+
"su github-runner -c 'export CUSTOM_HOSTNAME=${self.name}; export GH_USERNAME=${var.github_authentication_user}; export GH_TOKEN=${var.github_authentication_token}; export GH_OWNER=${var.github_owner}; export GH_NAME=${var.github_repository_name}; export GH_LABELS=${var.github_actions_runner_labels}; export GH_REPLACE_RUNNERS=${var.github_actions_runner_replace_existing}; export GH_RUNNER_TYPE=${var.github_runner_type}; /srv/setup-runner.sh'"
56+
]
5757
}
5858
}
5959

6060
resource "null_resource" "deprovision" {
6161
triggers = {
62-
machine_names = join(",", tolist(hcloud_server.github_runner.*.name))
63-
github_user = var.github_authentication_user
64-
github_user_token = var.github_authentication_token
65-
github_repo_name = var.github_repository_name
66-
github_repo_owner = var.github_owner
62+
machine_names = join(",", tolist(hcloud_server.github_runner.*.name))
63+
github_user = var.github_authentication_user
64+
github_user_token = var.github_authentication_token
65+
github_repo_name = var.github_repository_name
66+
github_repo_owner = var.github_owner
6767
github_runner_type = var.github_runner_type
6868
}
6969

7070
provisioner "local-exec" {
71-
when = destroy
72-
command = "./scripts/local/destroy_runner.sh ${self.triggers.machine_names} ${self.triggers.github_user} ${self.triggers.github_user_token} ${self.triggers.github_repo_name} ${self.triggers.github_repo_owner} ${self.triggers.github_runner_type}"
71+
when = destroy
72+
command = "./scripts/local/destroy_runner.sh ${self.triggers.machine_names} ${self.triggers.github_user} ${self.triggers.github_user_token} ${self.triggers.github_repo_name} ${self.triggers.github_repo_owner} ${self.triggers.github_runner_type}"
7373
}
74-
}
74+
}

variables.tf

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,113 @@
11
# Set the variable value in *.tfvars file
22
# or using the -var="hcloud_token=..." CLI option
33
variable "hcloud_token" {
4-
description = "Hetzner Cloud API token"
5-
type = string
4+
description = "Hetzner Cloud API token"
5+
type = string
66
}
77

88
variable "ssh_private_key" {
9-
description = "Defines the path to the location of the private key. The private key is used together with the public key to connect to the machine."
10-
default = "~/.ssh/id_rsa"
11-
type = string
9+
description = "Defines the path to the location of the private key. The private key is used together with the public key to connect to the machine."
10+
default = "~/.ssh/id_rsa"
11+
type = string
1212
}
1313

1414
variable "ssh_public_key" {
15-
description = "Public Key to authorized the access to the machines"
16-
default = "~/.ssh/id_rsa.pub"
17-
type = string
15+
description = "Public Key to authorized the access to the machines"
16+
default = "~/.ssh/id_rsa.pub"
17+
type = string
1818
}
1919

2020
variable "ssh_username" {
21-
description = "Username that should be used to connect to the nodes"
22-
default = "root"
23-
type = string
21+
description = "Username that should be used to connect to the nodes"
22+
default = "root"
23+
type = string
2424
}
2525

2626
variable "ssh_key_name" {
27-
description = "Defines the name for the ssh key"
28-
default = "admin_ssh_key"
29-
type = string
27+
description = "Defines the name for the ssh key"
28+
default = "admin_ssh_key"
29+
type = string
3030
}
3131

3232
resource "hcloud_ssh_key" "admin_ssh_key" {
33-
name = var.ssh_key_name
34-
public_key = file(var.ssh_public_key)
33+
name = var.ssh_key_name
34+
public_key = file(var.ssh_public_key)
3535
}
3636

3737
variable "hetzner_machine_type" {
38-
description = "Sets the machine type to use."
39-
default = "cx11"
40-
type = string
38+
description = "Sets the machine type to use."
39+
default = "cx11"
40+
type = string
4141
}
4242

4343
variable "hetzner_machine_os" {
44-
description = "Defines the machine operating system to be installed."
45-
default = "debian-10"
46-
type = string
44+
description = "Defines the machine operating system to be installed."
45+
default = "debian-10"
46+
type = string
4747
}
4848

49-
variable hetzner_additional_public_key_ids {
50-
description = "Adds public keys to the server that are already registered at hetzner"
51-
default = []
52-
type = list(string)
49+
variable "hetzner_additional_public_key_ids" {
50+
description = "Adds public keys to the server that are already registered at hetzner"
51+
default = []
52+
type = list(string)
5353
}
5454

55-
variable hetzner_machine_additional_packages {
56-
description = "Defines additional packages that must be installed on the machine. Each package name must be separated by a space ` `."
57-
default = ""
58-
type = string
55+
variable "hetzner_machine_additional_packages" {
56+
description = "Defines additional packages that must be installed on the machine. Each package name must be separated by a space ` `."
57+
default = ""
58+
type = string
5959
}
6060

61-
variable hetzner_machine_location {
62-
description = "Specifies the location of the data center where the machine is to be deployed."
63-
default = "nbg1"
64-
type = string
61+
variable "hetzner_machine_location" {
62+
description = "Specifies the location of the data center where the machine is to be deployed."
63+
default = "nbg1"
64+
type = string
6565
}
6666

6767
//
6868

6969
variable "github_actions_runner_count" {
70-
description = "Defines the number of runners to be provided. This option is equal to Machines at hetzner."
71-
default = 1
72-
type = number
70+
description = "Defines the number of runners to be provided. This option is equal to Machines at hetzner."
71+
default = 1
72+
type = number
7373
}
7474

7575
variable "github_actions_runner_labels" {
76-
description = "Defines a list of labels used to identify the runners. The list is divided by separating the individual entries with `,`."
77-
default = ""
78-
type = string
76+
description = "Defines a list of labels used to identify the runners. The list is divided by separating the individual entries with `,`."
77+
default = ""
78+
type = string
7979
}
8080

8181
variable "github_actions_runner_replace_existing" {
82-
description = "Specifies whether to replace existing Github action runners with the same name."
83-
default = false
84-
type = bool
82+
description = "Specifies whether to replace existing Github action runners with the same name."
83+
default = false
84+
type = bool
8585
}
8686

8787
variable "github_owner" {
88-
description = "Defines the organisation name or repository owner."
89-
default = ""
90-
type = string
88+
description = "Defines the organisation name or repository owner."
89+
default = ""
90+
type = string
9191
}
9292

9393
variable "github_repository_name" {
94-
description = "Sets the name of the repository. This option is only used if you use self-hosted Github runners at the repository level."
95-
default = ""
96-
type = string
94+
description = "Sets the name of the repository. This option is only used if you use self-hosted Github runners at the repository level."
95+
default = ""
96+
type = string
9797
}
9898

9999
variable "github_authentication_user" {
100-
description = "Sets the user used for issuing new registration tokens. Ensure that the user has the appropriate permissions. "
101-
type = string
100+
description = "Sets the user used for issuing new registration tokens. Ensure that the user has the appropriate permissions. "
101+
type = string
102102
}
103103

104104
variable "github_authentication_token" {
105-
description = " Sets the personal access token for the configured user in the variable github_authentication_user."
106-
type = string
105+
description = " Sets the personal access token for the configured user in the variable github_authentication_user."
106+
type = string
107107
}
108108

109109
variable "github_runner_type" {
110-
description = "Defines the github runner type. Available values are: repo, org"
111-
default = "repo"
112-
type = string
110+
description = "Defines the github runner type. Available values are: repo, org"
111+
default = "repo"
112+
type = string
113113
}

0 commit comments

Comments
 (0)