Install an OS via autoinstallation using Terraform
Automatic OS installation will delete data on all disks.
We recommend that you save your data or create a backup before installing the OS.
You can install an OS via Terraform only using auto-installation. OS auto-installation is available only for pre-built servers without upgrades. For a pre-built server with upgrades, you can install an OS manually from your own image.
You can install an OS on the server that differs from the current one, or reinstall the current OS.
Install a new OS
Reinstall the OS
-
Open the CLI.
-
Make sure you are in the directory with the configuration file.
-
Specify the required OS in the data source
selectel_dedicated_os_v1:data "selectel_dedicated_os_v1" "server_os" {project_id = selectel_vpc_project_v2.project_1.idfilter {name = "<os_image_name>"version_name = "<version_name>"configuration_id = data.selectel_dedicated_configuration_v1.server_config.configurations[0].idlocation_id = data.selectel_dedicated_location_v1.server_location.locations[0].id}}Specify:
<os_image_name>— the OS family name, for exampleUbuntu;<version_name>is the OS version, for example22.04. You can view the OS version in the Standard OS Images table or using the List OS configurations method via the Dedicated Servers API.
-
Check that the configuration file is free of errors:
terraform validate -
Format the configuration file:
terraform fmt -
Check the changes:
terraform plan -
Apply the changes:
terraform apply -
Confirm the creation by entering yes and pressing Enter. The changes will be displayed in the Control Panel.
-
Wait for the OS installation to finish.