---
page_title: "ona_project Resource - ona"
subcategory: "Projects"
description: |-
Ona project backed by a Git repository. Use this resource to define the repository, branch, environment classes, and optional prebuild settings that Ona should use for environments created from the project.
---
# ona_project (Resource)
Ona project backed by a Git repository. Use this resource to define the repository, branch, environment classes, and optional prebuild settings that Ona should use for environments created from the project.
For product context, see [Project configuration](https://ona.com/docs/ona/projects/overview) and [Create your first project](https://ona.com/docs/ona/create-first-project).
## Example Usage
```terraform
resource "ona_project" "api" {
name = "acme-api"
repository_clone_url = "https://github.com/acme/api.git"
branch = "main"
insights_enabled = true
devcontainer_file_path = ".devcontainer/devcontainer.json"
environment_class {
environment_class_id = ona_environment_class.large.id
order = 0
}
environment_class {
local_runner = true
order = 1
}
prebuild_configuration {
enabled = true
environment_class_ids = [ona_environment_class.large.id]
timeout = "1h"
enable_jetbrains_warmup = true
daily_schedule {
hour_utc = 5
}
executor {
id = ona_service_account.terraform.id
principal = "service_account"
}
}
}
```
## Schema
### Required
- `branch` (String) Git branch name Ona should use when creating environments and prebuilds.
- `name` (String) Project display name shown in Ona.
- `repository_clone_url` (String) Git repository clone URL. Use an HTTP(S) or SSH clone URL, such as `https://github.com/ona/example.git` or `git@github.com:ona/example.git`.
### Optional
- `automations_file_path` (String) Path to the tasks and services configuration, relative to the repository root. Omit to let Ona use its default discovery behavior.
- `devcontainer_file_path` (String) Path to the devcontainer file, relative to the repository root. Omit to let Ona use its default discovery behavior.
- `environment_class` (Block List) Environment classes available to this project, in priority order. Configure at least one block. Each block must set exactly one of `environment_class_id` or `local_runner = true`. (see [below for nested schema](#nestedblock--environment_class))
- `insights_enabled` (Boolean) Whether Ona Insights is enabled for the project. Defaults to `false`.
- `prebuild_configuration` (Block List) Prebuild configuration for the project. Set no more than one block. Omitting the block disables Terraform management of prebuild settings. Warm pools for prebuilt environment classes are managed separately with `ona_warm_pool` resources. (see [below for nested schema](#nestedblock--prebuild_configuration))
### Read-Only
- `created_at` (String) Time when the project was created.
- `creator` (Attributes) Identity that created the project. (see [below for nested schema](#nestedatt--creator))
- `id` (String) Project ID.
### Nested Schema for `environment_class`
Required:
- `order` (Number) Priority order for this environment class entry. Lower values are preferred first and values must be unique within the project.
Optional:
- `environment_class_id` (String) Runner environment class ID to make available to this project. Omit when `local_runner` is true.
- `local_runner` (Boolean) Whether this entry represents the user's local runner. Set to `true` instead of `environment_class_id` for local-runner projects.
### Nested Schema for `prebuild_configuration`
Optional:
- `daily_schedule` (Block List) Daily UTC prebuild schedule. Set no more than one block. (see [below for nested schema](#nestedblock--prebuild_configuration--daily_schedule))
- `enable_jetbrains_warmup` (Boolean) Whether JetBrains IDE warmup runs during prebuilds. Defaults to the provider value `false`.
- `enabled` (Boolean) Whether prebuilds are enabled for this project. Defaults to the provider value `true` when the prebuild block is present.
- `environment_class_ids` (Set of String) Environment class IDs for which prebuilds should be created. Omit to let Ona use project defaults.
- `executor` (Block List) Subject whose SCM credentials are used to run prebuilds. Set no more than one block. Omit to use Ona defaults. (see [below for nested schema](#nestedblock--prebuild_configuration--executor))
- `timeout` (String) Maximum duration allowed for a prebuild to complete, as a Go duration string. Must be between `5m` and `2h`; defaults to the provider value `1h`.
### Nested Schema for `prebuild_configuration.daily_schedule`
Required:
- `hour_utc` (Number) UTC hour of day, from 0 through 23, when the prebuild should start.
### Nested Schema for `prebuild_configuration.executor`
Required:
- `id` (String) Executor subject ID.
- `principal` (String) Executor principal type. Supported values are `user` and `service_account`.
### Nested Schema for `creator`
Read-Only:
- `id` (String) Subject ID.
- `principal` (String) Subject principal type.
## Import
Import is supported using the following syntax:
The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:
```shell
#!/usr/bin/env sh
terraform import ona_project.api 00000000-0000-0000-0000-000000000000
```