Terraform module which creates server on TimeWeb Cloud
#
# With preset
#
module "server" {
source = "https://github.com/deff-dev/terraform-timeweb-cloud-server.git"
name = "Single-preset"
project_name = "Общий проект"
os = {
name = "ubuntu"
version = "22.04"
}
location = "ru-1"
cpu_frequency = 3.3
disk_type = "nvme"
preset = {
cpu = 1
ram = 1
disk = 15
price = {
min = 100
max = 200
}
}
ssh_keys = ["key_name_1", "key_name_2"]
ssh_keys_paths = [
{
name = "key1"
path = "/local/path/to/key1.pub"
},
{
name = "key2"
path = "/local/path/to/key2.pub"
}
]
cloud_init = {
file = "cloud_init.tftpl"
vars = {
package_web = "nginx"
php_version = 8.2
}
}
providers = {
twc = twc.default
}
}
provider "twc" {
token = "token"
alias = "default"
}
#
# With configurator
#
module "server" {
source = "https://github.com/deff-dev/terraform-timeweb-cloud-server.git"
name = "Single-configurator"
project_name = "Общий проект"
os = {
name = "ubuntu"
version = "22.04"
}
location = "ru-1"
cpu_frequency = 3.3
disk_type = "nvme"
configurator = {
cpu = 1
ram = 4
disk = 5
}
ssh_keys = ["key_name_1", "key_name_2"]
ssh_keys_paths = [
{
name = "key1"
path = "/local/path/to/key1.pub"
},
{
name = "key2"
path = "/local/path/to/key2.pub"
}
]
cloud_init = {
file = "cloud_init.tftpl"
vars = {
package_web = "nginx"
php_version = 8.2
}
}
providers = {
twc = twc.default
}
}
provider "twc" {
token = "token"
alias = "default"
}
- Can select only preset or configurator for one server
Name | Version |
---|---|
terraform | >= 1.3 |
timeweb-cloud | >= 1.1.0 |
Name | Version |
---|---|
timeweb-cloud | >= 1.1.0 |
No modules.
Name | Type |
---|---|
twc_server.default | resource |
twc_ssh_key.default | resource |
twc_os.default | data source |
twc_presets.default | data source |
twc_configurator.default | data source |
twc_ssh_keys.default | data source |
twc_projects.default | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
timeweb_token | TimeWeb Token | string |
null |
no |
name | Name for server | string |
"Managed by terraform" |
yes |
project_name | Name of existing project | string |
null |
no |
os | Information about specified OS | object |
{ |
yes |
location | Location for the server (ru-1, ru-2, pl-1, kz-1) | string |
null |
no |
cpu_frequency | Current CPU frequency of server (2.8, 3.3, 5) | number |
3.3 |
no |
disk_type | Disk type for the created server (ssd, nvme, hdd) | string |
null |
no |
preset | Settings for the server with preset | object |
null |
no |
configurator | Settings for the server with configurator | object |
null |
no |
ssh_keys | List of names SSH Keys for server | list(string) |
null |
no |
ssh_keys_paths | Local paths of SSH Keys for server | list(object) |
null |
no |
cloud_init | Cloud-init script | object |
null |
no |
Name | Description |
---|---|
server_network | Return all information about server network |
server_public_ip | Return server public IP |
server_name | Return server name |
server_id | Return server id |
server_cloud_init | Return cloud init script |
Module is maintained by Deff.
Thanks for help alxrem.
Apache 2 Licensed. See LICENSE for full details.