image_ref rolls out as a deploy, and scaling changes apply to the running app. An app built from uploaded source (source_type = "console") deploys when you upload it with raff apps deploy --dir.
Terraform does not wait for a deploy to finish: status shows its progress at the next refresh. The app is created in the provider’s project, so set project_id in the provider block or RAFF_PROJECT_ID.
Example
raff apps github:
Creating an app from GitHub needs a recent GitHub sign-in by the API key’s owner: in the last 7 days they must have pressed Continue with GitHub on the dashboard’s create page, and their GitHub account must be able to see the repository in that connection. Otherwise the apply is refused with “Continue with GitHub, then choose the repository again. Raff only deploys repositories your GitHub account can see.”
Argument reference
An app has at most 6 instances and an account at most 20. Scaling arguments (
replicas, autoscaling_enabled, min_replicas, max_replicas, scale_to_zero) change the running app in place. Workers and private apps that stay awake run a fixed count.
Destroying the resource deletes the app. Usage up to deletion is billed, and linked databases are not deleted.
Environment variables
env and secret_env track only the keys you set in them. Variables a database link sets, and ones added in the dashboard or with the CLI, are left alone and never show as changes. Removing a key from either map deletes the variable. New and changed keys are set together in one call, so they redeploy the app once.
The variables reach the running app (runtime scope). For build-time variables, use raff apps env set --scope build. Do not set the names a database link uses, such as DATABASE_URL: a link is refused when the app already has a variable with one of its names.
Link a database
There are two ways to link a managed PostgreSQL database. They do the same thing, so use one per database:link_database_idlinks it when the app is created. The app waits until the database runs, then deploys withDATABASE_URLand the otherDATABASE_*variables set from its first deploy. If the database is not running within 30 minutes, the app deploys without it.raff_app_database_linklinks a database to an app that already exists and redeploys it.
raff_database.<name>.id:
Attribute reference (computed)
Import
id that raff apps get <app-id> --output json prints. An import does not read back github_installation_id or link_database_id. Leave them out of an imported app’s configuration, or list them in lifecycle { ignore_changes }, or Terraform plans to replace the app. env and secret_env start empty after an import, so the next apply sets the keys in your configuration and redeploys the app once.