terraform-provider-mozoutmz/docs/resources/vps.md
2026-11-28 15:28:10 +02:00

73 lines
2.8 KiB
Markdown

---
page_title: "mozoutmz_vps Resource - MozOut Mozambique"
subcategory: "VPS"
description: |-
A MozOut Mozambique VPS: buy a new one or manage one you already have.
---
# mozoutmz_vps (Resource)
A MozOut Mozambique VPS. Set `product_id` and `billing_cycle` to buy a new server with credit, or `server_id` to manage a server you already have (nothing is bought).
The provider can start and stop the server and change its time zone and reverse DNS. Reinstalling, restoring backups and changing the root password are not done by Terraform: use the API or Meu MozOut.
`terraform destroy` only removes the server from the state. The API cannot cancel services: cancel it in Meu MozOut.
## Example Usage
```terraform
data "mozoutmz_catalog_products" "vps" {
kind = "vps"
}
resource "mozoutmz_vps" "web" {
product_id = data.mozoutmz_catalog_products.vps.products[0].id
billing_cycle = "monthly"
power_state = "running"
timezone = "Africa/Maputo"
}
resource "mozoutmz_vps" "existing" {
server_id = 12345
power_state = "running"
reverse_dns = {
"203.0.113.10" = "mail.example.co.mz"
}
}
```
## Schema
### Optional
- `server_id` (Number) Id of a server you already have. Changing it points the resource to another server.
- `product_id` (Number) Catalog product to buy. Cannot change after the purchase.
- `billing_cycle` (String) `monthly`, `quarterly`, `semi_annually`, `annually`, `biennially` or `triennially`. Required with `product_id`. Cannot change after the purchase.
- `config_options` (Map of Number) Choices of the purchase, `{ "option id" = choice id }`, from the `mozoutmz_catalog_product` data source. Options left out get the first choice.
- `promo_code` (String) Promo code for the purchase.
- `power_state` (String) `running` or `stopped`. When not set, it is only read.
- `timezone` (String) Time zone, such as `UTC`.
- `reverse_dns` (Map of String) Name of each IP, `{ "ip" = "hostname" }`. Only the IPs listed are managed; an empty name goes back to the default.
- `wait_minutes` (Number) How long to wait for a new server and for power actions. Default `30`.
### Read-Only
- `id` (String) Server id.
- `name`, `status`, `product`, `ip`, `operating_system`, `location`, `next_due_date` (String)
- `additional_ips` (List of String)
- `vcpu`, `ram_gb`, `disk_gb` (Number)
- `order_id`, `invoice_id` (Number) Only when Terraform bought the server.
- `simulated` (Boolean) True when the purchase was simulated with a `sandbox_` key.
## Notes
- Power actions go into a queue: starting takes about 2 minutes and stopping about 6. Each server does one action at a time, with 15 seconds between actions.
- The power state comes from a copy up to a minute old.
## Import
```shell
terraform import mozoutmz_vps.existing 12345
```
Keep `server_id = 12345` in the configuration.