Перейти к основному содержимому

selectel_dedicated_server_v1

Последнее изменение:
к сведению

Эта инструкция — копия документации Selectel Terraform-провайдера в Terraform Registry.

Creates and manages a server in Selectel Dedicated Servers using public API v1. For more information about Dedicated Servers, see the official Selectel documentation.

Example usage

resource "selectel_dedicated_server_v1" "server_1" {
project_id = selectel_vpc_project_v2.project_1.id
configuration_id = data.selectel_configuration_v1.server_config.configurations[0].id
location_id = data.selectel_location_v1.server_location.locations[0].id
os_id = data.selectel_os_v1.server_os.os[0].id
price_plan_name = "1 day"
os_host_name = "Turing"
public_subnet_id = data.selectel_public_subnet_v1.subnets.subnets[0].id
ssh_key_name = "deploy-ed25519"
os_password = "Passw0rd!"
user_data = file("init-script-dir/init.sh")
partitions_config {
soft_raid_config {
name = "first-raid"
level = "raid1"
disk_type = "SSD NVMe M.2"
}
disk_partitions {
mount = "/boot"
size = 1
raid = "first-raid"
}
disk_partitions {
mount = "swap"
size_percent = 10.5
raid = "first-raid"
}
disk_partitions {
mount = "/"
size = -1
raid = "first-raid"
}
disk_partitions {
mount = "second_folder"
size = 400
raid = "first-raid"
fs_type = "xfs"
}
}
# Optional: You can choose your own timeout values or remove them.
#
# Current values represent default values.
timeouts {
create = "80m"
update = "20m"
delete = "5m"
}
}

Argument Reference

  • project_id — (Required) Unique identifier of the associated project. Retrieved from the selectel_vpc_project_v2 resource. Learn more about Projects.

  • configuration_id — (Required) Unique identifier of the server configuration. Retrieved from the selectel_dedicated_configuration_v1 data source.

  • location_id — (Required) Pool where the server is located, for example, ru-3. Learn more about available pools in the Availability matrix.

  • os_id — (Required) Unique identifier of the operating system to install. Changing this installs new os on a new server. Installing new os will delete all data on the server. Retrieved from the selectel_dedicated_os_v1 data source.

  • price_plan_name — (Required) Name of the price plan. Available tariff plans are 1 day, 1 month, 3 months, 6 months, 12 months, and 12 months • monthly payment. Learn more about tariff plans in the Payment model and prices of a dedicated server.

  • os_password — (Optional) Password for the OS user.

  • user_data — (Optional) These are custom configuration settings that automatically perform common tasks or run server setup scripts, reducing the time it takes to configure and deploy your infrastructure. Learn more about user data in the User data on a dedicated server.

  • ssh_key — (Optional) Public SSH key to be added to the server.

  • ssh_key_name — (Optional) Name of an existing SSH key to be added to the server. Learn more about add a public SSH key to the SSH key repository in the Create and host an SSH key on a dedicated server.

  • partitions_config — (Optional) Configuration for disk partitions. Learn more about disk partitioning in the Install the OS by auto-installation.

    • soft_raid_config — (Optional) Configuration for software RAID.

      • name — (Required) Name of the RAID array.

      • level — (Required) RAID level.

      • disk_type — (Required) Type of disks to use in the RAID.

    • disk_partitions — (Optional) Configuration for disk partitions.

      • mount — (Required) Mount point for the partition.

      • size — (Optional) Size of the partition in GB. Use only size or size_percent.

      • size_percent — (Optional) Size of the partition in percent. Use only size or size_percent.

      • raid — (Required) RAID array name to create the partition on.

      • fs_type — (Optional) Filesystem type for the partition. Available file system types are swap, ext4, ext3, and xfs.

  • public_subnet_id — (Optional) ID of the public subnet to connect the server to. Retrieved from the selectel_dedicated_public_subnet_v1 data source.

  • public_subnet_ip — (Optional) Public IP to use. Can be set instead of public_subnet_id.

  • os_host_name — (Optional) Hostname for the server.

  • force_update_additional_params — (Optional) Enables or disables update for additional os params (os_password, user_data, ssh_key, ssh_key_name, partitions_config, os_host_name) without changing os_id. Installing new os will delete all data on the server.

Attributes Reference

  • id — Unique identifier of the server. To get the ID, in the Control panel, go to ProductsDedicated ServersServersServer ⟶ Servers page ⟶ in the menu select Copy UUID.

Import

You can import a server:

export OS_DOMAIN_NAME=<account_id>
export OS_USERNAME=<username>
export OS_PASSWORD=<password>
export INFRA_PROJECT_ID=<selectel_project_id>
terraform import selectel_dedicated_server_v1.server_1 <server_id>

where:

  • <account_id> — Selectel account ID. The account ID is in the top right corner of the Control panel. Learn more about Registration.

  • <username> — Name of the service user. To get the name, in the Control panel, go to AccountService users ⟶ copy the name of the required user. Learn more about Service users.

  • <password> — Password of the service user.

  • <selectel_project_id> — Unique identifier of the associated project. To get the ID, in the Control panel, go to ProductsDedicated Servers ⟶ project name ⟶ Project management ⟶ copy the ID of the required project. Learn more about Projects.

  • <server_id> — Unique identifier of the server. To get the ID, in the Control panel, go to ProductsDedicated ServersServersServer ⟶ Servers page ⟶ in the menu select Copy UUID.