---
title: "Dedicated Servers in Terraform"
sidebar_label: "Terraform"
sidebar_position: 1
description: "How to manage dedicated servers in Terraform, and the specifics of managing dedicated servers"
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import {CustomTable} from '@selectel/docux/components'
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical'

# Dedicated Servers in Terraform

Terraform is an infrastructure as code tool for cloud or dedicated servers from HashiCorp. Infrastructure and its components are described using HashiCorp Configuration Language (HCL) in configuration files with the `.tf` extension. Learn more about the tool in the [What is Terraform](https://developer.hashicorp.com/terraform/intro)? article in the HashiCorp documentation.

Terraform manages infrastructure using providers, which are special plugins that interact with the APIs of services and platforms.

Dedicated servers are managed using the [Selectel provider](/terraform/selectel-provider-reference/), which provides the [selectel\_dedicated\_server\_v1](/terraform/selectel-provider-reference/resources/dedicated_server_v1/) resource. Learn more about resource management in the [Manage Terraform resources](/terraform/manage-resources/) guide.

To install Terraform and set up the Selectel provider, use the [Set up a Terraform environment](/terraform/configure-terraform-environment/) guide. When working with dedicated servers via Terraform, pay attention to the [specifics of managing dedicated servers](#features-of-managing-dedicated-servers-in-terraform). See examples of building infrastructure in the [Dedicated servers](/terraform/examples/dedicated/) section of the Terraform documentation.

## Specifics of managing dedicated servers in Terraform \{#features-of-managing-dedicated-servers-in-terraform}

<CustomTable>
  <table>
    <tbody>
      <tr>
        <th>Ordering a server</th>

        <td>
          * you can only order [prebuilt configuration servers](/dedicated/order/dedicated-configurations.mdx#prebuilt-servers);
          * if you need to assign a public IP address to a server, add [public dedicated IP addresses](/dedicated/networks/public-networks-and-subnets.mdx#add-additional-ips) in the Control Panel beforehand;
          * [assigning a private IP address to a server](/dedicated/networks/private-networks-and-subnets.mdx#assign-private-ip-address-to-server) can only be done in the Control Panel;
          * if you need an SSH key on the server, add [it to the SSH key repository](/dedicated/manage/create-and-place-ssh-key.mdx#add-public-ssh-key-to-ssh-key-repository) in the Control Panel beforehand
        </td>
      </tr>

      <tr>
        <th>Server upgrade</th>

        <td>
          * you cannot order an [upgrade for a prebuilt configuration server](/dedicated/order/change-server-configuration.mdx#prebuilt-server-upgrade) via Terraform
        </td>
      </tr>

      <tr>
        <th>OS autoinstallation</th>

        <td>
          * [automatic OS installation](/dedicated/manage/autoinstall-os.mdx) is only available for [prebuilt configuration servers without an upgrade](/dedicated/order/change-server-configuration.mdx#prebuilt-server-upgrade);
          * automatic OS installation will remove data from all disks
        </td>
      </tr>

      <tr>
        <th>Canceling a server and resuming service</th>

        <td>
          * after [canceling a dedicated server](/dedicated/about/disable-server.mdx), the server will remain active until the end of the paid period;
          * you cannot resume a service via Terraform. You can resume a server lease in the [Control panel](https://my.selectel.ru/servers/): in the top menu, click **Products** → **Dedicated servers** → server page → in the <MoreVerticalIcon /> menu, select **Resume server lease**. After resuming the service, [import](/terraform/selectel-provider-reference/resources/dedicated_server_v1/#import) the server into Terraform
        </td>
      </tr>
    </tbody>
  </table>
</CustomTable>

<Formbricks />
