Faxter Terraform Reference
1. faxter_project
Use Case
A Faxter Project is the logical grouping of resources and billing. You need a project (unless you’re using the default project) to create servers, networks, etc.
Schema Reference
- name (String, Required): The name of the project.
Note: you are required to top-up or fund the project’s account before creating other resources.
Example
resource "faxter_project" "example" {
name = "my-cool-project"
}
2. faxter_server
Use Case
A Faxter Server is a virtual machine. You can set its flavor, image, networks, volumes, and security groups, as well as inject cloud_init.
Schema Reference
- project (String, Optional, defaults to "default"): Project name in which the server is created.
- name (String, Required): Unique name of the server.
- key_name (String, Required): The SSH key name associated with this server (must exist in Faxter).
- flavor (String, Optional, defaults to "copper"): The server size/flavor (e.g., "copper", "silver", "gold", etc.).
- image (String, Optional, defaults to "Ubuntu2204"): The OS image for the VM.
- security_groups (List of String, Optional, defaults to [ "default" ]): One or more security groups to apply.
- request_floating_ip (Bool, Optional, defaults to true): Whether or not to auto-assign a floating/public IP.
- cloud_init (String, Optional, defaults to ""): The user-data for cloud-init. Can be loaded via file("cloud_init.yaml").
- networks (List of String, Optional, defaults to [ "public1" ]): Which networks to attach.
- sub_networks (List of String, Optional), used in place of networks to specify subnet name that the server will connected to
- volumes (List of String, Optional, defaults to []): Which volumes to attach.
- status (String, Computed): The current status of the server (e.g., online, paused, terminated).
- ip_addresses (List of String, Computed): The IP addresses assigned to the server.
Example
resource "faxter_server" "example" {
project = "default"
name = "my-server"
key_name = "my-ssh-key"
flavor = "copper"
image = "Ubuntu2204"
networks = ["public1"]
security_groups = ["default"]
cloud_init = file("${path.module}/cloud_init.yaml")
}
3. faxter_ssh_key
Use Case
Manages SSH Keys in Faxter so you can associate them with servers for passwordless SSH access.
Schema Reference
- project (String, Optional, defaults to "default"): Which project this key belongs to.
- name (String, Required): Name of the SSH key (must be unique within the project).
- public_key (String, Required, Sensitive): The actual public key content (e.g., ssh-rsa AAAAB3NzaC1yc2E...).
Example
resource "faxter_ssh_key" "example" {
project = "default"
name = "my-ssh"
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ..."
}
4. faxter_network
Use Case
A Faxter Network is a private network (VPC-like) that can contain one or more subnets. Servers can attach to these networks for isolation and internal communication.
Schema Reference
- project (String, Optional, defaults to "default"): The project in which this network is created.
- name (String, Required): Unique name of the network.
- subnets (List of Objects, Required): List of subnets to create within this network. Each element has:
- name (String, Required): The subnet’s name.
- cidr (String, Required): The CIDR block for the subnet (e.g., "192.168.10.0/24").
- gateway (String, optional): The gateway IP address (e.g. "192.168.10.1")
- static_routes (List of Objects, optional): Each element has:
- destination (String, Required): The CIDR of the destination
- nexthop (String, Required): IP address of next hop
Example
resource "faxter_network" "example" {
project = "my-project"
name = "private-network"
subnets {
name = "subnet1"
cidr = "192.168.10.0/24"
}
subnets {
name = "subnet2"
cidr = "192.168.11.0/24"
}
}
5. faxter_router
Use Case
A Faxter Router connects one or more internal networks/subnets to an external/public network. Allows traffic routing to/from the internet or between networks.
Schema Reference
- project (String, Optional, defaults to "default"): The project in which the router is created.
- name (String, Required): Unique name of the router.
- connect_external (Bool, Optional, defaults to true): Whether the router should connect to an external/public network.
- subnets (List of String, Required): Names of the subnets or networks to attach.
Example
resource "faxter_router" "example" {
project = "my-project"
name = "my-router"
connect_external = true
subnets = [
faxter_network.private_net.subnets[0].name
]
}
6. faxter_security_group
Use Case
A Faxter Security Group defines firewall rules for controlling inbound (ingress) and outbound (egress) traffic to servers.
Schema Reference
- project (String, Required): Project in which the security group is created.
- name (String, Required): Unique name of the security group.
- rules (List of Objects, Optional): Defines traffic rules. Each element can have:
- protocol (String, Optional, defaults to "tcp").
- port_range_min (Int, Optional): Start of port range.
- port_range_max (Int, Optional): End of port range.
- direction (String, Optional, defaults to "ingress"): ingress or egress.
- remote_ip_prefix (String, Optional, defaults to "0.0.0.0/0"): Allowed source/destination CIDR.
- remote_group_id (String, Optional): If referencing another security group instead of a CIDR.
- ether_type (String, Optional, defaults to "IPv4").
Example
resource "faxter_security_group" "db_sg" {
project = "my-project"
name = "db-sg"
rules {
protocol = "tcp"
port_range_min = 3306
port_range_max = 3306
direction = "ingress"
remote_group_id = "web-sg" # Only allow traffic from 'web-sg' group
}
}
7. faxter_volume
Use Case
A Faxter Volume is a block storage device that can be attached to a server for persistent data.
Schema Reference
- project (String, Required): Project to place this volume.
- name (String, Required): Unique name of the volume.
- storage (Int, Required): The size of the volume (in GB or whichever unit your API uses).
Example
resource "faxter_volume" "db_volume" {
project = "my-project"
name = "db-data"
storage = 100
}
- faxter_loadbalancer
Use Case
A Faxter Load Balancer distributes incoming traffic across multiple backend servers, optionally assigning a floating IP, attaching to certain networks, etc.
Schema Reference
- project (String, Optional, defaults to "default").
- name (String, Required): Unique LB name.
- port (Int, Optional, defaults to 80): The port on which the LB listens.
- networks (List of String, Optional, defaults to [ "public1" ]): Networks the LB is attached to.
- key_name (String, Optional): If the LB runs in a VM-based manner and needs an SSH key.
- request_floating_ip (Bool, Optional, defaults to true): If it should have a public floating IP.
- ssl_enabled (Bool, Optional, defaults to false): Whether SSL termination is enabled.
- servers (List of Objects, Optional, defaults to []): The backend servers or endpoints. Each server has
- ip (string, ip address, e.g. "182.168.1.20")
- port (int port number, e.g. 80)
- endpoint (string, path for healthcheck, e.g. "/")
- security_groups (List of String, Optional, defaults to [ "default" ]): Security groups applied to the LB.
- status (String, Computed): The load balancer’s current status if returned by the API.
Example
resource "faxter_loadbalancer" "example" {
project = "my-project"
name = "frontend-lb"
port = 443
ssl_enabled = true
key_name = "my-lb-ssh-key"
request_floating_ip = true
networks = ["public1"]
servers = {
ip = "10.0.1.10"
port = "8080
endpoint "/"
}
servers = {
ip = "10.0.1.11"
port = "8080
endpoint "/"
}
security_groups = ["default", "web-sg"]
// status is computed
}