-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvariables.tf
168 lines (168 loc) · 6.56 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
variable "release" {
type = string
description = <<-EOT
The release version of RKE2 to install.
This should be the specific release tag to install.
If you loaded your binary in the local file, this must be set and match that version.
You can also set "stable" or "latest" here to get the version automatically.
The stable and latest versions are dictated by the channels.yaml file in the Rancher/rke2 git repo https://github.com/rancher/rke2/blob/master/channels.yaml.
EOT
}
variable "rpm_channel" {
type = string
description = <<-EOT
The RPM release channel to install.
This should be "stable", "latest", or "testing".
This is not necessary unless setting the install_method to "rpm".
Occasionally a version will not have a "stable" RPM, this will result in a 404 from downloading artifacts.
This will default to "stable" if not set, try setting to "latest" if you encounter problems.
EOT
default = ""
}
variable "role" {
type = string
description = <<-EOT
The kubernetes role of the server to install RKE2 on.
May be 'server' or 'agent', defaults to 'server'.
EOT
default = "server"
}
variable "local_manifests_path" {
type = string
description = <<-EOT
The local path to a directory with manifests that will be copied to the /var/lib/rancher/rke2/server/manifests directory on the server.
EOT
default = ""
}
variable "local_file_path" {
type = string
description = <<-EOT
The path to the directory on the machine running Terraform with the files to use.
If left empty, the root module path + rke2 will be used. eg. '~/root/module/path/rke2'
The module will copy the files in the given directory to the remote server.
Different install methods have different requirements: for rpm install, you don't need to include any files.
Place your rke2 configs here, make sure they have .yaml file endings.
For 'tar' install method, files must match expected file names for the installer to succeed:
"rke2-images.<system>-<arch>.tar.gz",
"rke2.<system>-<arch>.tar.gz",
"sha256sum-<arch>.txt",
"install.sh"
EOT
}
variable "remote_file_path" {
type = string
description = <<-EOT
The path to the directory for the files on the remote server. eg. "/tmp/rke2"
Files must match expected file names:
"rke2-images.<system>-<arch>.tar.gz",
"rke2.<system>-<arch>.tar.gz",
"sha256sum-<arch>.txt",
"install.sh",
The user specified in the ssh_user variable must have read and write permissions to this directory.
If left blank "/home/<ssh_user>/rke2" will be used.
EOT
default = ""
}
variable "remote_workspace" {
type = string
description = <<-EOT
The path to a directory where the module can store temporary files and execute scripts. eg. "/var/tmp"
The user specified in the ssh_user variable must have read, write, and execute permissions to this directory.
If left blank "/home/<ssh_user>" will be used.
EOT
default = "~"
}
variable "ssh_ip" {
type = string
description = <<-EOT
The IP address of the server to install RKE2 on.
We will attempt to open an ssh connection on this IP address.
Ssh port must be open and listening, and the user must have sudo/admin privileges.
This script will only run the install script, please ensure that the server is ready.
EOT
validation {
condition = (
anytrue([
can(regex("^(?:[[:digit:]]{1,3}\\.){3}[[:digit:]]{1,3}$", var.ssh_ip)), # IPv4
can(regex("^(?:[[:xdigit:]]{0,4}\\:{1,7}){1,7}[[:xdigit:]]{0,4}$", var.ssh_ip)), # IPv6
])
)
error_message = "Address must be an IPv4 or IPv6 address with lower case letters."
}
}
variable "ssh_user" {
type = string
description = <<-EOT
The user to log into the server to install RKE2 on.
We will attempt to open an ssh connection with this user.
The user must have sudo/admin privileges.
This script will only run the install script, please ensure that the server is ready.
EOT
}
variable "identifier" {
type = string
description = <<-EOT
A unique identifier for the resources in this module.
If this value is changed, the resources will be recreated.
This value is the only trigger for recreating resources,
use it to upgrade or manage the rke2 lifecycle.
EOT
}
variable "retrieve_kubeconfig" {
type = bool
description = <<-EOT
Whether or not to retrieve the kubeconfig from the server.
If this is set to true, the module will retrieve the kubeconfig from the server and write it to a file.
The file will be named "kubeconfig-<identifier>.yaml" and will be written to the root directory.
The module replaces the default IP (127.0.0.1) with the IP address of the server (ssh_ip).
If this is set to false, the module will not retrieve the kubeconfig from the server.
EOT
default = false
}
variable "install_method" {
type = string
description = <<-EOT
The install method to set when running the install script.
This should be one of "tar" or "rpm".
The default is tar, which assumes you are downloading the files and want to copy them over to the remote server.
This is the most contained method, and does not require public internet access on the remote server.
If you are using the rpm install method, your server will need to be able to access the internet to download the rpms.
EOT
default = "tar"
}
variable "server_prep_script" {
type = string
description = <<-EOT
The content of a script to run on the server before starting RKE2.
This script will be run as root.
This is useful for preparing the server to run RKE2 after installation.
This can help mitigate issues like those found in https://docs.rke2.io/known_issues
EOT
default = ""
}
variable "server_install_prep_script" {
type = string
description = <<-EOT
The content of a script to run on the server before installing RKE2.
This script will be run as root.
This is useful for installing dependencies or configuring the server.
EOT
default = ""
}
variable "start" {
type = bool
description = <<-EOT
Should the module start rke2.
There are some limited situations where we want to install rke2, but not start it.
Starting rke2 is the default behavior.
EOT
default = true
}
variable "start_timeout" {
type = string
description = <<-EOT
The number of minutes to wait for rke2 to start.
This defaults to '10' which will translate to 10 minutes / 600 seconds.
EOT
default = "10"
}