# Discovery Projects

Source: https://docs.ops0.com/docs/discovery/projects

After running a discovery scan, you organise selected resources into **Discovery Projects** before generating Terraform code. A Discovery Project is a logical grouping — it defines which resources will be brought into a single IaC project, and how their Terraform state will be stored.

---

## Why Projects?

A single discovery session might return hundreds of resources across many services. Discovery Projects let you:

- **Group by team or application** — put all networking resources in one project, all databases in another
- **Control state backends separately** — each project can write state to a different S3 bucket or path
- **Generate focused IaC** — smaller, purpose-built Terraform projects are easier to maintain than one giant file

---

## Creating a Discovery Project

Discovery Projects are created during the import flow inside the Discovery Wizard.

### Complete a discovery scan
Run a scan and reach the **Resources** step.

### Select resources
Check the resources you want to include in this project.

### Click Organise into Project
In the **Project Selection** step, choose **Create New Project**.

### Name the project
Enter a descriptive name (e.g. `production-networking`, `analytics-databases`).

### Choose a state backend
Select where Terraform state will be stored. Options:

| Backend | Use Case |
|---------|----------|
| **AWS S3** | Standard choice for AWS resources |
| **GCP Cloud Storage** | Standard choice for GCP resources |
| **Azure Blob Storage** | Standard choice for Azure resources |
| **Oracle Object Storage** | Standard choice for OCI resources |

### Configure backend details
Enter bucket name, region, and path for the state file.

### Finish
Click **Create Project** to save. The project is ready for code generation.

---

## State Management Modes

Each Discovery Project can use one of two state modes:

| Mode | Description |
|------|-------------|
| **Per-project** | Each Discovery Project has its own state file at a unique path |
| **Global** | All Discovery Projects in the org share a common state configuration |

Per-project mode is recommended — it keeps each project's state isolated and prevents accidental cross-project state corruption.

---

## Managing Existing Projects

Navigate to **Discovery → Projects** to view and manage your Discovery Projects.

### Project List

Each project shows:

| Field | Description |
|-------|-------------|
| **Name** | Project name |
| **Resources** | Number of resources assigned |
| **Backend** | State backend type and location |
| **IaC Project** | Linked IaC project (if generated) |
| **Last updated** | When the project was last modified |

### Actions

| Action | Description |
|--------|-------------|
| **Open** | View resources and generated code |
| **Edit** | Rename or change backend configuration |
| **Regenerate** | Re-run code generation for updated resources |
| **Delete** | Remove the Discovery Project (does not delete the IaC project or cloud resources) |

---

## Adding and Removing Resources

Resources can be reassigned between Discovery Projects:

1. Open the Discovery Project
2. Click **Manage Resources**
3. Add resources from other sessions or remove existing ones
4. Click **Save**

After changing resource assignments, regenerate the Terraform code to reflect the updated resource set.

---

## From Discovery Project to IaC Project

Once a Discovery Project has generated code, it links to an IaC Project where you can validate, plan, and apply:

```
Discovery Session
  └── Discovery Project: "production-networking"
        ├── Resources: VPC, 4 subnets, IGW, NAT, 3 security groups
        ├── State backend: s3://my-state/networking/terraform.tfstate
        └── IaC Project: "production-networking" (linked)
              ├── main.tf (generated)
              ├── imports.tf (import blocks)
              └── variables.tf
```

Open the linked IaC project directly from the Discovery Project view by clicking **Open IaC Project**.

---

## Related

- [Scanning Resources](https://docs.ops0.com/docs/discovery/scanning): Run discovery scans to find cloud resources

- [Importing Resources](https://docs.ops0.com/docs/discovery/importing): Generate Terraform code from discovered resources

- [IaC Projects](https://docs.ops0.com/docs/iac/projects): Manage IaC projects created from discovery
