> 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 của VergeOS

Nhà cung cấp Terraform của VergeOS cho phép quản lý hạ tầng dưới dạng mã của các tài nguyên VergeOS bao gồm VM, mạng và người dùng thông qua cấu hình Terraform và OpenTofu.

## Tổng quan

Trình cung cấp Terraform VergeOS 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ã. Trình cung cấp 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ác cấu hình Terraform, mang lại 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

* Cấp phát tự động máy ảo, mạng, ổ đĩa và người dùng VergeOS
* Quy trình hạ tầng dưới dạng mã cho môi trường VergeOS
* Triển khai hạ tầng được kiểm soát phiên bản
* Tích hợp với các quy trình 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 Trình cung cấp Terraform VergeOS, 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 = "~> 2.7"
    }
  }
}

provider "vergeio" {
  host     = "địa-chỉ-ip-hoặc-tên-máy-chủ-của-bạn"
  username = "tên-người-dùng-của-bạn"
  password = "mật-khẩu-của-bạn"
}
```

Đố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 = "~> 2.7"
    }
  }
}
```

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

Trình cung cấp 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ý người dùng
* `vergeio_member` - Quản lý thành viên nhóm
* `vergeio_tag_member` - Gán thẻ cho các đối tượng VergeOS

## Ví dụ sử dụng

### Tạo 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ạng

```hcl
resource "vergeio_network" "example" {
  name         = "mạng-nội-bộ-mẫu"
  network      = "192.168.1.0/24"
  dhcp_enabled = true
  dhcp_start   = "192.168.1.100"
  dhcp_stop    = "192.168.1.200"
}
```

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

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

* [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/)
* [Thực hành tốt 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
