Terraform and OpenTofu
The virtscale/virtscale provider drives the VirtScale customer API from Terraform and OpenTofu. One
provider serves both tools, and both install it from registry.terraform.io: write that registry in the
source, see Installation. It is available from v0.1.0; these pages describe
v0.2.0 and later.
Registry documentation, one page per resource and data source: Terraform registry and OpenTofu registry, once the provider is listed there.
What it manages
Section titled “What it manages”| Resource | What it is |
|---|---|
virtscale_instance |
A compute instance |
virtscale_instance_firewall |
The whole firewall rule set of one instance |
virtscale_public_ip |
A public IP address, optionally associated with an instance |
virtscale_project |
A project, which groups instances, public IPs and networks |
virtscale_vpc |
A VPC: a private address space in one project and one region. VPCs are not switched on in production yet: an apply fails with 503 not_ready |
virtscale_ssh_key |
An SSH public key imported into the organization; instances take it by name |
virtscale_s3_bucket |
An object storage bucket, with optional size and object ceilings |
virtscale_s3_access_key |
An S3 access key for the organization’s storage |
Data sources read what a configuration chooses from:
| Data source | What it returns |
|---|---|
virtscale_regions |
The regions the organization may see |
virtscale_images |
The images an instance can boot from, in one region |
virtscale_compute_limits |
The size grid a new instance must sit on: the vCPU counts, and the memory and disk ranges |
virtscale_instance_types |
The public instance types. None can be ordered in production yet, so it returns none |
virtscale_plans |
The Managed VPS plans |
virtscale_project |
One project by name, or the organization’s default project |
virtscale_caller |
Who the API key is: its organization, scopes and permissions |
What it does not manage
Section titled “What it does not manage”Members, invitations and API keys. People manage those in the panel: no API key scope covers them, so a leaked key cannot mint keys or widen its own reach.
How it behaves
Section titled “How it behaves”- Apply waits for the platform. Creating an instance waits up to 20 minutes for state
running, and destroying one waits up to 10 minutes. In tests against production, creating took 31 to 59 seconds and destroying 12 to 16 seconds. - Most attributes of an instance force a replacement.
hostname,disable_api_termination,vcpusandmemory_mbchange in place; a change ofvcpusormemory_mbrestarts the instance. - An instance takes cloud-init text as
user_data: sensitive, read at the first boot, and never read back. - The provider does not manage an instance’s power state. See Your first instance.
- The provider retries what is safe to repeat, and says so when it gives up. See Troubleshooting.
Where to start
Section titled “Where to start”- Installation: declare the provider.
- Authentication: create an API key and set two environment variables.
- Your first instance: an instance you can log in to.
- Object storage: a bucket and an access key.
- Import existing resources: bring what you made in the panel under management.
- Troubleshooting: the errors you can meet and what to do.
The provider calls the same API as the API reference.