---
title: "Configure the environment for Terraform"
sidebar_label: "Configure the environment"
sidebar_position: 2
description: "How to configure the environment for working with Terraform"
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import ConfigureProviders from '@site/i18n/en/docusaurus-plugin-content-docs-terraform/current/_partials/common/configure-providers.mdx'
import ConfigureSelectelProviders from '@site/i18n/en/docusaurus-plugin-content-docs-terraform/current/_partials/common/configure-selectel-providers.mdx'
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'

# Configure the environment for working with Terraform

1. [Install Terraform](#install-terraform).
2. [Create a service user](#add-service-user).
3. [Configure providers](#configure-providers).

## 1. Install Terraform \{#install-terraform}

1. Download the Terraform distribution for your operating system from the [HashiCorp website](https://developer.hashicorp.com/terraform/install) or from a [mirror](https://mirror.selectel.ru/3rd-party/hashicorp-releases/terraform/). We recommend downloading Terraform version 1.9.
2. If you downloaded the Terraform distribution from the mirror, export the path to it to the `PATH` environment variable:

   ```sh
   export PATH=$PATH:<path>
   ```

   Specify `<path>` — the path to the Terraform binary file.
3. Install Terraform. For Linux and macOS, follow the [Install Terraform](https://developer.hashicorp.com/terraform/install) instructions in the HashiCorp documentation.

## 2. Create a service user \{#add-service-user}

To work with the [examples](/terraform/examples/), you need to create a service user with two [roles](/access-control/access-management/#roles):

* [`member`](/access-control/role-reference/#member) in the Account or Project scope — this role is required to initialize the Selectel provider and create resources. The scope affects available operations; you can view them in the [member](/access-control/role-reference/#member) section of the [Roles Reference](/access-control/role-reference) guide;
* and [`iam.admin`](/access-control/role-reference/#iam-admin) — to create additional users and manage access within projects.

<br />

1. In the [control panel](https://my.selectel.ru/iam/service-users), click **IAM** in the top menu.

2. Go to the **Service users** section.

3. Click **Add service user**.

4. In the **Service user details** block:

   4.1. Enter the username. It will be used for authorization.

   4.2. Enter a password for the user or generate one. After creating the user, the password cannot be viewed — you can only [change it](/access-control/manage/edit-user-data-or-role/#change-service-user-password). The password must be at least 20 characters long and contain at least:

   * one uppercase and one lowercase Latin letter (`A-Z`, `a-z`);
   * one digit (`0-9`);
   * one special character from the ASCII Printable 7-Bit Special Characters list:<br />`!"#$%&'()*+,-./:;<=>?@[]^_{|}~.`

5. In the **Account access** block:

   5.1. Configure the permission for [`iam.admin`](/access-control/role-reference/#iam-admin) by selecting:

   * [scope](/access-control/access-management/#scopes) — Account;
   * [role](/access-control/access-management/#roles) — `iam.admin`.

   5.2. Click **Add permission**.

   5.3. Configure the permission for [`member`](/access-control/role-reference/#member) by selecting:

   * [scope](/access-control/access-management/#scopes) — Account or Project;
   * [role](/access-control/access-management/#roles) — `member`.

   5.4. Optional: select a [group](/access-control/groups/) for the user.

6. Click **Add user**. They will be added to the list on the **Service users** page. The account will be active immediately.

## 3. Configure providers \{#configure-providers}

If the Selectel Terraform provider version in use is below 6.0.0, you can upgrade it. For more information, see the [Upgrading Terraform Selectel Provider to version 6.0.0](https://registry.terraform.io/providers/selectel/selectel/latest/docs/guides/upgrading_to_version_6) guide on the Terraform Registry.

<Tabs queryString="configure-provides">
  <TabItem value="selectel-and-openstack" default>
    <TabItemLabel>
      Selectel and OpenStack providers
    </TabItemLabel>

    <ConfigureProviders />
  </TabItem>

  <TabItem value="only-selectel">
    <TabItemLabel>
      Selectel provider
    </TabItemLabel>

    <ConfigureSelectelProviders />
  </TabItem>
</Tabs>

<Formbricks />
