> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/automate-protect-and-extend/vi/tich-hop-va-api/terraform-provider.md).

# Nhà cung cấp Terraform cho VergeOS

## Tổng quan

VergeOS Terraform Provider cho phép quản lý môi trường VergeOS của bạn theo kiểu hạ tầng dưới dạng mã (infrastructure-as-code). Provider này cho phép bạn định nghĩa, triển khai và quản lý các tài nguyên VergeOS bằng cấu hình Terraform, cung cấp khả năng tự động hóa cho việc quản lý hạ tầng ảo của bạn.

## Tính năng chính

* Tự động cấp phát máy ảo, mạng, ổ đĩa và người dùng VergeOS
* Quy trình làm việc hạ tầng dưới dạng mã cho các môi trường VergeOS
* Triển khai hạ tầng được kiểm soát bằng phiên bản
* Tích hợp với các quy trình làm việc Terraform và OpenTofu hiện có
* Tạo và quản lý môi trường có thể tái tạo

## Cài đặt và Cấu hình

Để sử dụng VergeOS Terraform Provider, hãy thêm nội dung sau vào cấu hình Terraform của bạn:

```hcl
terraform {
  required_providers {
    vergeio = {
      source = "verge-io/vergeio"
      version = "~> 0.1.0"
    }
  }
}

provider "vergeio" {
  host     = "your-vergeos-ip-or-hostname"
  username = "your-username"
  password = "your-password"
}
```

Đối với người dùng OpenTofu, cấu hình vẫn giữ nguyên:

```hcl
terraform {
  required_providers {
    vergeio = {
      source = "verge-io/vergeio"
      version = "~> 0.1.0"
    }
  }
}
```

## Tài nguyên có sẵn

Provider hỗ trợ quản lý các tài nguyên VergeOS sau:

* `vergeio_vm` - Tạo và quản lý máy ảo
* `vergeio_network` - Cấu hình và quản lý mạng ảo
* `vergeio_user` - Cấp phát và quản lý tài nguyên lưu trữ

## Ví dụ sử dụng

### Tạo một Máy ảo

```hcl
resource "vergeio_vm" "example" {
  name        = "example-vm"
  cpu_cores   = 2
  ram         = 4096  # MB
  description = "Máy ảo mẫu được tạo bởi Terraform"

  
  vergeio_drive {
    disksize            = 20  #GB
    interface           = "virtio-scsi"
    preferred_tier      = 2
  }
  
  vergeio_nic {
    vnet       = vergeio_network.example.id
    interface  = "virtio"
  }
}
```

### Cấu hình một Mạng

```hcl
resource "vergeio_network" "example" {
  name             = "example-internal-network"
  network_address  = "192.168.1.0/24"
  dns_server_list  = ["8.8.8.8", "8.8.4.4"]
  dhcp_enabled     = true
  dhcp_start       = "192.168.1.100"
  dhcp_end         = "192.168.1.200"
  }
}
```

## Tài liệu và tài nguyên

Để có tài liệu đầy đủ, bao gồm tất cả tài nguyên được hỗ trợ, nguồn dữ liệu và các ví dụ sử dụng chi tiết, vui lòng truy cập tài liệu chính thức của provider:

* [Tài liệu Terraform Registry](https://registry.terraform.io/providers/verge-io/vergeio/latest/docs)
* [Tài liệu OpenTofu Registry](https://search.opentofu.org/provider/verge-io/vergeio/latest)
* [Kho lưu trữ GitHub](https://github.com/verge-io/terraform-provider-vergeio)

## Hỗ trợ

Nếu bạn gặp sự cố hoặc có yêu cầu tính năng, vui lòng mở một issue trên kho lưu trữ GitHub:

<https://github.com/verge-io/terraform-provider-vergeio/issues>

## Tài nguyên bổ sung

* [Tài liệu Terraform](https://developer.hashicorp.com/terraform/docs)
* [Tài liệu OpenTofu](https://opentofu.org/docs/)
* [Các phương pháp hay nhất về Hạ tầng dưới dạng Mã](https://www.hashicorp.com/resources/what-is-infrastructure-as-code)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/automate-protect-and-extend/vi/tich-hop-va-api/terraform-provider.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
