A comprehensive Terraform module for managing Tsuru applications with Infrastructure as Code (IaC).
This module addresses several key challenges in Tsuru application management:
- Complete Tsuru application lifecycle management
- Automatic scaling configuration
- Environment variables management (sensitive and non-sensitive)
- Custom CNAMEs and SSL certificates
- Service instance bindings
- Multiple routers support
- Process-level customization with metadata
module "my_app" {
source = "github.com/tsuru/terraform-tsuru-app"
name = "my-application"
description = "My awesome application"
platform = "python"
plan = "c0.5m1"
pool = "production"
team_owner = "my-team"
tags = ["api", "production"]
processes = [
{
name = "web"
custom_plan = "c2m4"
autoscale_target_cpu = 75
autoscale_min_units = 3
autoscale_max_units = 20
labels = {
"process" = "api"
}
},
{
name = "worker"
autoscale_target_cpu = 80
autoscale_min_units = 2
autoscale_max_units = 10
}
]
environment_variables = {
LOG_LEVEL = "info"
APP_ENV = "production"
}
private_environment_variables = {
API_KEY = "your-api-key-here"
SECRET_TOKEN = "your-secret-token"
}
# CNAMEs with optional SSL certificates
cnames = [
{
hostname = "myapp.example.com"
issuer = "letsencrypt" # Creates CNAME + SSL certificate
},
{
hostname = "api.example.com"
issuer = "letsencrypt" # Creates CNAME + SSL certificate
},
{
hostname = "staging.example.com"
# No issuer - only creates CNAME
}
]
}Check the examples/ directory for complete usage examples:
- simple - Basic usage showing both autoscale and fixed units configuration
Each example includes a detailed README with instructions and important notes about deployment requirements.
- Terraform >= 1.8
For more details on how to contribute please see the contributing guideline.
This module is maintained by:
Feel free to reach out to the maintainers for questions, suggestions, or if you're interested in becoming a maintainer yourself.
| Name | Version |
|---|---|
| terraform | >= 1.8 |
| tsuru | ~> 2.17.1 |
| Name | Version |
|---|---|
| tsuru | ~> 2.17.1 |
No modules.
| Name | Type |
|---|---|
| tsuru_app.app | resource |
| tsuru_app_autoscale.app_scale | resource |
| tsuru_app_cname.app_cname | resource |
| tsuru_app_deploy.app_deploy | resource |
| tsuru_app_env.app_env | resource |
| tsuru_app_grant.team | resource |
| tsuru_app_router.app_router | resource |
| tsuru_app_unit.app_unit | resource |
| tsuru_certificate_issuer.cert | resource |
| tsuru_service_instance_bind.app_bind | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| annotations | Annotations metadata | map(string) |
{} |
no |
| app_units | Configures fixed units (tsuru_app_unit) per process. Can only be used when the process does not have autoscale configured (autoscale_* not set). | list( |
[] |
no |
| binds | App binds | list( |
[] |
no |
| cnames | CNAMEs for the application. If issuer is provided, a certificate will be created | list( |
[] |
no |
| custom_cpu_burst | CPU burst factory override | number |
null |
no |
| default_router | Tsuru app default router (see: tsuru router list) | string |
"none" |
no |
| deploy | Deploy the app after creation | bool |
false |
no |
| description | Tsuru app description | string |
n/a | yes |
| environment_variables | non-sensitive app ENV variables | map(string) |
{} |
no |
| image | Image to be used by the app | string |
"" |
no |
| labels | Labels metadata | map(string) |
{} |
no |
| name | Tsuru app name | string |
n/a | yes |
| plan | Tsuru app plan (see: tsuru plan list) | string |
"c0.1m0.1" |
no |
| platform | Tsuru app platform | string |
n/a | yes |
| pool | Tsuru pool (see: tsuru pool list) | string |
n/a | yes |
| private_environment_variables | Sensitive app ENV variables | map(string) |
{} |
no |
| processes | Tsuru process configuration. Fields: name (required). Autoscale is optional: to enable it, set autoscale_target_cpu/autoscale_min_units/autoscale_max_units. Optional fields: custom_plan, annotations, labels, scale_down, schedule, prometheus | list( |
n/a | yes |
| restart_on_update | Whether to restart the app when its configuration or processes are updated | bool |
true |
no |
| routers | Tsuru app routers (see: tsuru router list) | set(string) |
[] |
no |
| tags | Tsuru tags | set(string) |
n/a | yes |
| team_grants | List of teams to grant access to the application | set(string) |
[] |
no |
| team_owner | Tsuru app team owner | string |
n/a | yes |
| Name | Description |
|---|---|
| app_cluster | The name of the cluster where the app is deployed |
| app_cnames | List of CNAMEs configured for the application |
| app_description | Application description |
| app_environment_variables | Application environment variables (non-sensitive) |
| app_name | Application name |
| app_platform | Application platform |
| app_pool | Application pool |
| app_processes | Application processes with autoscaling configuration |
| app_routers | List of additional routers configured for the application |
| app_tags | Application tags |
| app_team_owner | Application team owner |