> ## Documentation Index
> Fetch the complete documentation index at: https://blog.onetsolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform & OpenTofu provider: VPS, DNS and hosting as code

> The OnetSolutions Terraform and OpenTofu provider describes your VPS, networks, DNS, domains and web hosting as code, and builds them in one command.

*Published on November 14, 2026*

You build your VPS, networks, DNS zones and hosting by hand, one click at a time, and start over every time you need a copy of an environment? Since November 10, 2026, the **OnetSolutions Terraform provider** lets you describe your infrastructure in configuration files. `terraform apply` creates it, changes it or removes it. The same configuration works with OpenTofu.

## What is a Terraform provider?

A provider connects Terraform to a platform. You write the state you want in HCL; Terraform compares it with what exists, shows you a plan, then applies the changes.

Your configuration becomes the source of truth. Kept in Git, it can be reviewed, shared and replayed: a test environment identical to production is one command away.

Terraform and OpenTofu both install the provider from their own registry, as `onetsolutions-net/onetsolutions`.

## What you can manage as code

Version 0.2.0, released on November 11, 2026, covers compute, networking, domains and web hosting.

| Area | Resources |
| - | - |
| Compute | Instances (with a public IPv6 address if you want one), snapshots, backups, GPUs |
| Network | VPCs, instance firewalls, reverse DNS of your IP addresses |
| Access | SSH keys |
| DNS and domains | Domain registration and settings, DNS zones and records, DNSSEC |
| Web hosting | Web hostings, PHP version, WordPress, databases and their users, mailboxes, FTP accounts, cron jobs, subdomains, addon domains, redirects |

Data sources help you choose before you declare anything: `onetsolutions_instance_sizes`, `onetsolutions_images`, `onetsolutions_tlds`, `onetsolutions_domain_availability` and `onetsolutions_hosting_plans`.

## Reboot, reinstall and restore from your configuration

The provider also ships **actions**: reboot an instance, reset it, reinstall it from an image or restore one of its backups, straight from your configuration.

| Situation | Action |
| - | - |
| Reboot an instance | `onetsolutions_instance_reboot` |
| Reset an instance | `onetsolutions_instance_reset` |
| Start again from a clean image | `onetsolutions_instance_reinstall` |
| Roll back to a backup | `onetsolutions_instance_backup_restore` |

> [!NOTE]
>
> Actions need Terraform 1.14 or later; OpenTofu does not run them. Every resource and data source works with both Terraform and OpenTofu.

## Get started with the OnetSolutions Terraform provider

You need an OnetSolutions account, an API key, and Terraform 1.5 or later, or OpenTofu 1.6 or later.

### 1. Create an API key

Create an [API key in the console](https://help.onetsolutions.net/console/api-keys). It acts with your rights, in every organization and project you can reach.

Keep it out of your configuration files by passing it in an environment variable:

```bash theme={null}
# The key stays out of your Git repository
export ONETSOLUTIONS_API_KEY="sk-onetsolutions-…"
```

### 2. Describe your infrastructure

An SSH key and a private network, in a `main.tf` file:

```hcl theme={null}
terraform {
  required_providers {
    onetsolutions = {
      source  = "onetsolutions-net/onetsolutions"
      version = "~> 0.2"
    }
  }
}

provider "onetsolutions" {}

resource "onetsolutions_ssh_key" "laptop" {
  name       = "laptop"
  public_key = file("~/.ssh/id_ed25519.pub")
}

resource "onetsolutions_vpc" "private" {
  name       = "private"
  cidr_block = "10.0.0.0/16"
}
```

### 3. Apply

```bash theme={null}
terraform init && terraform apply     # or: tofu init && tofu apply
```

When your account has several organizations or projects, set `organization_id` and `project_id` on the provider, or on each resource.

> [!NOTE]
>
> Creating an instance, a web hosting or a domain places an order, billed like an order from the console. The plan tells you before anything is ordered or cancelled.

## Bring what you built in the console under code

Everything you created in the console can be imported, with an `import` block or `terraform import`. Each resource page of the provider documentation gives its import ID:

```hcl theme={null}
import {
  to = onetsolutions_ssh_key.laptop
  id = "<organization_id>/<project_id>/<ssh_key_id>"
}
```

> [!TIP]
>
> Import your existing resources first, then run `terraform plan`: an empty plan confirms your configuration matches your infrastructure.

## Go further

* Step-by-step guide: [Terraform and OpenTofu with the console](https://help.onetsolutions.net/console/terraform).
* Every resource, with examples: [the provider documentation](https://registry.terraform.io/providers/onetsolutions-net/onetsolutions/latest/docs).
* An idea or a bug in the provider: [open an issue on GitHub](https://github.com/onetsolutions-net/terraform-provider-onetsolutions/issues/new/choose). For your account or billing, [open a support ticket](https://blog.onetsolutions.net/en/open-support-ticket-console.md).
* GPUs to attach to your instances: [NVIDIA GPUs on demand](https://blog.onetsolutions.net/en/nvidia-gpu-on-demand.md).

Not an OnetSolutions customer yet? It all starts at [onetsolutions.net](https://onetsolutions.net).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.