Skip to content

Terraform Provider

Manage WAYSCloud resources declaratively using the official Terraform provider. 12 resources and 8 data sources covering compute, networking, data, IoT, and application services.

Installation

hcl
terraform {
  required_providers {
    wayscloud = {
      source  = "wayscloudas/wayscloud"
      version = "~> 0.4"
    }
  }
}

provider "wayscloud" {
  api_key = var.wayscloud_api_key
}

Authentication

Two methods, depending on the resource:

hcl
# API key — for DNS, Storage, and other service-scoped resources
provider "wayscloud" {
  api_key = "wayscloud_api_xxx..."
}

# Personal Access Token (PAT) — required for databases, domain verification
provider "wayscloud" {
  pat_token = "wayscloud_pat_xxx..."
}

Set via environment variables to avoid hardcoding:

bash
export WAYSCLOUD_API_KEY="wayscloud_api_xxx..."
export WAYSCLOUD_PAT_TOKEN="wayscloud_pat_xxx..."
terraform plan

Note: Some resources (databases, domain verification) require a PAT with specific scopes. See the individual resource documentation for details.


Resources (12)

wayscloud_vps

Manages a VPS instance with full lifecycle control.

hcl
resource "wayscloud_vps" "web" {
  hostname     = "web01.example.com"
  display_name = "Production Web Server"
  plan_code    = "NO-Start-Linux-2cpu-4096mb-30gb"
  region       = "NO"
  os_template  = "ubuntu-24.04"

  ssh_keys = [
    "ssh-rsa AAAA..."
  ]
}

output "server_ip" {
  value = wayscloud_vps.web.ipv4_address
}

Windows Server:

hcl
resource "wayscloud_vps" "win" {
  display_name = "Windows Dev"
  plan_code    = "NO-Start-Windows-4cpu-8192mb-80gb"
  region       = "NO"
  os_template  = "windows-2022"
}

wayscloud_dns_zone

Manages a DNS zone with automatic nameserver assignment.

hcl
resource "wayscloud_dns_zone" "example" {
  name = "example.com"
}

Import: terraform import wayscloud_dns_zone.example example.com


wayscloud_dns_record

Manages DNS records in a zone. Supports A, AAAA, CNAME, MX, TXT, SRV, CAA, NS, and PTR.

hcl
resource "wayscloud_dns_record" "www" {
  zone_name = wayscloud_dns_zone.example.name
  name      = "www"
  type      = "A"
  value     = wayscloud_vps.web.ipv4_address
  ttl       = 300
}

resource "wayscloud_dns_record" "mail" {
  zone_name = wayscloud_dns_zone.example.name
  name      = ""
  type      = "MX"
  value     = "mail.example.com"
  ttl       = 3600
  priority  = 10
}

wayscloud_database

Manages PostgreSQL and MariaDB databases. Requires PAT authentication.

hcl
resource "wayscloud_database" "app" {
  name        = "myapp-prod"
  type        = "postgresql"
  tier        = "standard"
  description = "Production application database"
}

output "db_host" {
  value = wayscloud_database.app.host
}

output "db_connection" {
  value     = wayscloud_database.app.connection_string
  sensitive = true
}

MariaDB with encryption:

hcl
resource "wayscloud_database" "secure" {
  name = "secure-db"
  type = "mariadb"
  tier = "enterprise"
}

Requires PAT with database:read and database:write scopes.


wayscloud_s3_bucket

Manages S3-compatible storage buckets.

hcl
resource "wayscloud_s3_bucket" "uploads" {
  bucket_name = "my-app-uploads"
  tier        = "standard"
}

output "s3_endpoint" {
  value = wayscloud_s3_bucket.uploads.endpoint
}

output "s3_access_key" {
  value = wayscloud_s3_bucket.uploads.access_key
}

output "s3_secret_key" {
  value     = wayscloud_s3_bucket.uploads.secret_key
  sensitive = true
}

Enterprise tier (dedicated, encrypted):

hcl
resource "wayscloud_s3_bucket" "secure" {
  bucket_name = "encrypted-data"
  tier        = "enterprise"
}

wayscloud_redis_instance

Manages Redis instances.

hcl
resource "wayscloud_redis_instance" "cache" {
  name   = "my-cache"
  region = "no"
  plan   = "redis-starter"
}

output "redis_endpoint" {
  value = wayscloud_redis_instance.cache.endpoint
}

output "redis_password" {
  value     = wayscloud_redis_instance.cache.password
  sensitive = true
}

wayscloud_app

Manages container apps on the App Platform.

hcl
resource "wayscloud_app" "api" {
  name   = "My API"
  region = "no"
  plan   = "app-basic"

  env_vars = {
    NODE_ENV     = "production"
    DATABASE_URL = wayscloud_database.app.connection_string
  }
}

output "app_url" {
  value = wayscloud_app.api.default_url
}

wayscloud_iot_device

Manages IoT devices with MQTT credentials.

hcl
resource "wayscloud_iot_device" "sensor" {
  device_id   = "temp-sensor-01"
  name        = "Temperature Sensor #1"
  description = "Office temperature monitoring"
  device_type = "sensor"

  metadata = {
    location = "building-a"
    floor    = "2"
  }
}

output "mqtt_username" {
  value = wayscloud_iot_device.sensor.mqtt_username
}

output "mqtt_password" {
  value     = wayscloud_iot_device.sensor.mqtt_password
  sensitive = true
}

wayscloud_iot_device_group

Manages IoT device groups for organizing devices.

hcl
resource "wayscloud_iot_device_group" "floor2" {
  name        = "Floor 2 Sensors"
  description = "All sensors on the second floor"
}

wayscloud_iot_rule

Manages IoT rules for automated responses to device data.

hcl
resource "wayscloud_iot_rule" "temp_alert" {
  name      = "High Temperature Alert"
  rule_type = "threshold"
  severity  = "warning"
}

wayscloud_s3_bucket_key

Manages access keys for individual S3 buckets.

hcl
resource "wayscloud_s3_bucket_key" "app" {
  bucket_name = wayscloud_s3_bucket.uploads.bucket_name
  name        = "app-access-key"
}

output "bucket_access_key" {
  value = wayscloud_s3_bucket_key.app.access_key
}

output "bucket_secret_key" {
  value     = wayscloud_s3_bucket_key.app.secret_key
  sensitive = true
}

wayscloud_domain_verification

Manages domain ownership verification for services like email, DKIM, and SPF.

hcl
resource "wayscloud_domain_verification" "email" {
  domain              = "example.com"
  purpose             = "email"
  verification_method = "dns_txt"
}

resource "wayscloud_dns_record" "verification" {
  zone_name = "example.com"
  name      = wayscloud_domain_verification.email.dns_record_name
  type      = "TXT"
  value     = wayscloud_domain_verification.email.dns_challenge
  ttl       = 300
}

Requires PAT authentication.


Data Sources (8)

wayscloud_regions

List available datacenter regions.

hcl
data "wayscloud_regions" "available" {}

wayscloud_vps_plans

List VPS plans with pricing and specs.

hcl
data "wayscloud_vps_plans" "all" {
  region = "NO"
}

wayscloud_vps_os_templates

List available OS templates.

hcl
data "wayscloud_vps_os_templates" "all" {}

wayscloud_dns_zones

List your DNS zones.

hcl
data "wayscloud_dns_zones" "all" {}

wayscloud_app_plans

List App Platform plans.

hcl
data "wayscloud_app_plans" "all" {}

wayscloud_database_types

List available database type and tier combinations.

hcl
data "wayscloud_database_types" "all" {}

wayscloud_redis_plans

List available Redis plans.

hcl
data "wayscloud_redis_plans" "all" {}

wayscloud_storage_tiers

List available S3 storage tiers.

hcl
data "wayscloud_storage_tiers" "all" {}

Import

All resources support import:

bash
terraform import wayscloud_vps.web vps-abc123
terraform import wayscloud_dns_zone.main example.com
terraform import wayscloud_dns_record.www zone:example.com:record:12345
terraform import wayscloud_database.app myapp-prod
terraform import wayscloud_s3_bucket.uploads my-app-uploads
terraform import wayscloud_redis_instance.cache cache-abc123
terraform import wayscloud_app.api app-abc123
terraform import wayscloud_iot_device.sensor temp-sensor-01
terraform import wayscloud_domain_verification.email 550e8400-...

Full example: Web stack

hcl
# Complete web application stack

resource "wayscloud_vps" "app" {
  display_name = "App Server"
  plan_code    = "NO-Start-Linux-2cpu-4096mb-30gb"
  region       = "NO"
  os_template  = "ubuntu-24.04"
  ssh_keys     = [var.ssh_public_key]
}

resource "wayscloud_database" "db" {
  name = "webapp"
  type = "postgresql"
}

resource "wayscloud_s3_bucket" "assets" {
  bucket_name = "webapp-assets"
}

resource "wayscloud_dns_zone" "domain" {
  name = "myapp.com"
}

resource "wayscloud_dns_record" "root" {
  zone_name = wayscloud_dns_zone.domain.name
  name      = ""
  type      = "A"
  value     = wayscloud_vps.app.ipv4_address
  ttl       = 300
}

resource "wayscloud_redis_instance" "cache" {
  name   = "webapp-cache"
  region = "no"
  plan   = "redis-starter"
}

Next steps

WAYSCloud AS