[Yandex Cloud documentation](../../index.md) > [Terraform in Yandex Cloud](../index.md) > Concepts > Overview

# Overview

With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.

## Key advantages {#main-advantages}

* Automation: Terraform enables you to quickly and easily create, update, and delete cloud [resources](resources.md) for streamlined infrastructure management.
* Code reuse: Terraform supports [modules](modules.md) reusable across different projects. This reduces development and testing time.
* Security: Terraform provides version control and audit of infrastructure changes through [state](states.md) snapshots. This helps to prevent unauthorized changes and ensures data security.

## How Terraform works {#how-it-works}

Terraform follows a declarative approach to infrastructure management ([Infrastructure as Code](https://en.wikipedia.org/wiki/Infrastructure_as_code), IaC). You describe the desired end state of your infrastructure, and Terraform automatically creates, modifies, or deletes resources to achieve that state.

To use Terraform, install it on your computer, configure the provider, and create configuration files (`*.tf`) describing your infrastructure in [HashiCorp Configuration Language (HCL)](https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md). Then you can use Terraform commands to create, modify, or delete resources.

## Usage example {#example}

Let's assume you want to create a VM in Yandex Cloud. The following code describes the configuration of a `terraform1` VM with 2 cores and 2 GB of RAM, a boot disk named `boot-disk-1`, network interface connected to `subnet-1`, public IP address, and SSH key from a file located at the specified path:

```
resource "yandex_compute_instance" "vm-1" {
  name = "terraform1"

  resources {
    cores  = 2
    memory = 2
  }

  boot_disk {
    disk_id = yandex_compute_disk.boot-disk-1.id
  }

  network_interface {
    subnet_id = yandex_vpc_subnet.subnet-1.id
    nat       = true
  }

  metadata = {
    ssh-keys = "ubuntu:${file("~/.ssh/id_ed25519.pub")}"
  }
}
```

This is just a simple example of how you can use Terraform. With this tool, you can create complex infrastructures with multiple resources and dependencies, provide metadata, manage resources using service accounts, and more.

## Useful links {#see-also}

* [Providers](providers.md)
* [Resources](resources.md)
* [State](states.md)
* [Data sources in Terraform](data-sources.md)