Terraform Provider
Infrastructure as Code with the Macyou Terraform provider.
Navigation
Terraform Provider
Manage Macyou infrastructure as code with our official Terraform provider.
Installation
terraform {
required_providers {
macyou = {
source = "macyou/macyou"
version = "~> 1.0"
}
}
}
provider "macyou" {
api_key = var.macyou_api_key
}Example: Deploy a Server
resource "macyou_server" "ml_worker" {
name = "ml-worker-01"
chip = "m4-pro"
ram = 48
storage = 1024
stack = "ollama"
billing = "monthly"
ssh_key_ids = [macyou_ssh_key.deploy.id]
}
resource "macyou_ssh_key" "deploy" {
name = "deploy-key"
public_key = file("~/.ssh/id_ed25519.pub")
}
resource "macyou_firewall_rule" "ssh" {
server_id = macyou_server.ml_worker.id
direction = "inbound"
protocol = "tcp"
port = "22"
source = "0.0.0.0/0"
}
output "server_ip" {
value = macyou_server.ml_worker.ip
}