[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for YDB](../index.md) > Using YDB via Terraform > Installing and configuring Terraform and a provider to connect to YDB

# Installing and configuring Terraform and a provider to connect to YDB

You can download Terraform from the official [HashiCorp](https://developer.hashicorp.com/terraform/downloads) website. If the website is unavailable, use our [mirror](https://hashicorp-releases.yandexcloud.net/terraform/). Download the Terraform distribution for your platform and add the path to the folder with the executable to the `PATH: export PATH=$PATH:/path/to/terraform` variable.


## Installing Terraform for Windows, Linux, and macOS from the HashiCorp website {#terraform-install-on-dif-os}

{% list tabs group=operating_system %}

- Linux {#linux}

    * Download the [Terraform](https://developer.hashicorp.com/terraform/downloads) distribution and follow [this guide](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli?in=terraform%2Faws-get-started) to install it.

- macOS {#macos}

    * Download the [Terraform distribution](https://developer.hashicorp.com/terraform/downloads) and follow [this guide](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli?in=terraform%2Faws-get-started) to install it.
    * Install Terraform using the [Homebrew](https://brew.sh) package manager by running the `brew install terraform` command.

- Windows {#windows}

    * Download Terraform from the [official website](https://developer.hashicorp.com/terraform/downloads) and follow [this guide](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli?in=terraform%2Faws-get-started) to install it.
    * Install Terraform using the [Chocolatey](https://chocolatey.org/install) package manager by running the `choco install terraform` command.

{% endlist %}

Once you have installed Terraform, configure it to access YDB. First, install a provider to connect to YDB and provide API methods.


## Installing a provider for YDB {#provider-install}

Terraform will download and install a provider from the URL you specified in the `provider_installation` section of the `.terraformrc` file.

{% list tabs group=operating_system %}

- Linux/macOS {#linux}

    1. Open the Terraform CLI configuration file, `~/.terraformrc`, in any text editor.

        {% note info %}
        
        The `.terraformrc` file must be in the user's home root folder, e.g., `/home/user/` or `/User/user/`.
        
        {% endnote %}

    1. Add the following section to the file:

        ```tf
        provider_installation {
            network_mirror {
                url = "https://terraform-mirror.yandexcloud.net/"
                include = ["registry.terraform.io/*/*"]
            }
            direct {
                exclude = ["registry.terraform.io/*/*"]
            }
        }
        ```

- Windows {#windows}

    1. Open the Terraform CLI `terraform.rc` configuration file in your user's `%APPDATA%` folder.
    1. Add the following section to the file:

        ```tf
        provider_installation {
            network_mirror {
                url = "https://terraform-mirror.yandexcloud.net/"
                include = ["registry.terraform.io/*/*"]
        }
            direct {
                exclude = ["registry.terraform.io/*/*"]
            }
        }
        ```
		
{% endlist %}

This completes the installation and configuration of Terraform and the provider for connecting to YDB. You can move on to creating [configuration files](configure.md) for YDB access.