Provider Installation & Configuration
Comprehensive guide to installing the microsrv provider: OpenTofu registry, network and OCI mirrors, authentication parameters, and data sources.
Provider Overview
The microsrv provider is published and cryptographically verified in the official OpenTofu Registry under:
microsrv-cloud/microsrv
Canonical registry identifier: registry.opentofu.org/microsrv-cloud/microsrv.
Installation Methods
1. Official Registry (Recommended)
In most environments, simply reference the provider within the required_providers block:
terraform {
required_version = ">= 1.6.0"
required_providers {
microsrv = {
source = "microsrv-cloud/microsrv"
# Omit version to always track the latest release, or pin a version constraint:
# version = "~> 1.0"
}
}
}
Running tofu init fetches the binary, validates the GPG signature against the official Microsrv release key (Microsrv Releases <releases@microsrv.ru>, fingerprint 1EE5DF70…626C19FB), and locks hashes into .terraform.lock.hcl.
2. Network Mirror (GitHub Pages Fallback)
If registry.opentofu.org is unreachable from your network or CI environment, use the official GitHub Pages mirror following the standard Provider Network Mirror layout:
https://microsrv-cloud.github.io/terraform-provider-microsrv/
Configure OpenTofu by creating or updating ~/.tofurc (or the file specified in TF_CLI_CONFIG_FILE):
provider_installation {
network_mirror {
url = "https://microsrv-cloud.github.io/terraform-provider-microsrv/"
include = ["registry.opentofu.org/microsrv-cloud/microsrv"]
}
direct {
exclude = ["registry.opentofu.org/microsrv-cloud/microsrv"]
}
}
After updating your configuration, continue using source = "microsrv-cloud/microsrv" as normal. The mirror is updated on every new release.
3. OCI Mirror (GitHub Packages / GHCR)
Every provider release tag is published to GitHub Container Registry as an OCI artifact (requires OpenTofu >= 1.7; for unauthenticated anonymous pulls, OpenTofu >= 1.13 is recommended):
ghcr.io/microsrv-cloud/terraform-provider-microsrv:<version>
Add the following to ~/.tofurc:
provider_installation {
oci_mirror {
repository_template = "ghcr.io/microsrv-cloud/terraform-provider-microsrv"
include = ["registry.opentofu.org/microsrv-cloud/microsrv"]
}
direct {
exclude = ["registry.opentofu.org/microsrv-cloud/microsrv"]
}
}
[!NOTE] Custom mirrors record lock-file checksums only for the current host operating system and architecture. When collaborating in multi-platform teams, generate multi-architecture lock records:
tofu providers lock -platform=linux_amd64 -platform=linux_arm64 -platform=darwin_arm64 -platform=darwin_amd64
Authentication and Provider Configuration
The provider can be configured via HCL arguments in the provider "microsrv" block or through environment variables:
provider "microsrv" {
# API control plane endpoint (default: https://api.microsrv.ru)
endpoint = "https://api.microsrv.ru"
# Access token (PAT) prefixed with sel_
token = var.microsrv_token
}
| Block Argument | Environment Variable | Default Value | Description |
|---|---|---|---|
endpoint |
MICROSRV_ENDPOINT |
https://api.microsrv.ru |
Control plane API base URL |
token |
MICROSRV_TOKEN |
— | Personal Access Token (sel_…) |
api_key |
MICROSRV_API_KEY |
— | Alias for token (mutually exclusive with token) |
[!TIP] The recommended pattern for development and CI/CD pipelines is to omit credentials from HCL files and supply
export MICROSRV_TOKEN="sel_..."in your environment. The provider block can remain empty:provider "microsrv" {}
Data Sources Reference
The provider provides first-class data sources to dynamically resolve region identifiers, compute flavor profiles, and operating system images without hardcoding identifiers.
1. Regions (microsrv_regions and microsrv_region)
# List all active regions
data "microsrv_regions" "all" {}
# Lookup a specific region by short code
data "microsrv_region" "central" {
code = "ru-yndx-central"
}
output "primary_region_id" {
value = data.microsrv_region.central.id
}
2. Flavors (microsrv_flavors and microsrv_flavor)
Resource presets define vCPU and RAM allocations for virtual machines and containers:
# List all flavors
data "microsrv_flavors" "all" {}
# Lookup a specific flavor:
# - Virtual machines: std.1c2g, std.2c4g, std.4c8g (minimum 1 vCPU / 2 GiB RAM)
# - Containers: micro.1c512m, std.1c2g, std.2c4g
data "microsrv_flavor" "std" {
code = "std.1c2g"
}
data "microsrv_flavor" "micro" {
code = "micro.1c512m"
}
3. Operating System Images (microsrv_images and microsrv_image)
Base cloud images for provisioning bootable volumes:
# Lookup Ubuntu 24.04 LTS (Noble Numbat)
data "microsrv_image" "ubuntu" {
code = "ubuntu-noble"
}
4. Projects, Quotas, and Pricing
# Lookup an existing project by name
data "microsrv_project" "existing" {
name = "production"
}
# Inspect active project quotas
data "microsrv_quotas" "current" {}
# Live billing rates for compute and storage
data "microsrv_pricing" "rates" {}