Hey everyone,
I wanted to share a small project I’ve been working on: a Terraform provider for flespi.
It lets you manage subaccounts, tokens, and limits with code instead of clicking around in the UI.
Why it can help
If you’re using flespi for more than a tiny setup, you probably have:
• multiple subaccounts (for clients or environments)
• multiple tokens with different permissions
Doing this manually is fine at first, but it gets messy fast. With Terraform, you can:
• define everything as code
• easily recreate the same setup in dev/staging/prod
• rotate or update tokens without fuss
• avoid mistakes from manual configuration
For example, if you want to change a subaccount’s limits to pro, you just update one line in your Terraform file and run terraform apply - that’s it (look at the code below) 🚀🚀🚀
Example: subaccounts, limits, and tokens
terraform {
required_providers {
flespi = {
source = "mixser/flespi"
}
}
}
provider "flespi" {
token = "YOUR_MASTER_TOKEN"
}
# Define account limits
resource "flespi_limit" "basic" {
name = "basic-tier"
webhooks_count = 25
cdn_storage = 15
tokens_count = 5
}
resource "flespi_limit" "pro" {
name = "pro-tier"
webhooks_count = 50
cdn_storage = 20
tokens_count = 10
}
# Create a subaccount with a limit
resource "flespi_subaccount" "customer_1" {
name = "customer-1"
limit_id = flespi_limit.basic.id
}
# Create a token for that subaccount
resource "flespi_token" "customer_1_api" {
info = "API token for customer-1"
enabled = true
ttl = 86400
account_id = flespi_subaccount.customer_1.id
access = jsonencode({
type = 2
acl = [
{
uri = "gw/groups"
methods = ["GET", "POST"]
ids = "all"
},
{
uri = "mqtt"
topic = "/some/topic/#"
actions = ["publish"]
methods = ["POST"]
}
]
})
}
Current resource coverage
Flespi has a lot of resources, so I’ve started with the basics. If you need something else, please let me know — I can adjust priorities for implementation.
Currently supported:
Gateway:
• channels
• devices
• geofences
• streams
Platforms:
• limits
• subaccounts
• tokens
• webhooks
Storage:
• CDN
⚠️ I haven’t tested all resources in every possible configuration yet.
It’s still early, but I hope someone finds this useful!
Any feedback, suggestions, or questions are very welcome 🙂