# config.apply

How a dispra.yaml file becomes the state of an environment.

- **Starts when:** You change dispra.yaml
- **Involved:** Your code, Dispra API
- **Ends with:** The environment matches the file, and what changed is deploying
- **Takes:** Seconds, plus the deployments

## Steps

| Step | Who | What | Calls / logs |
|---|---|---|---|
| 1 | Your code | Sends the file to plan: every change it would make, in order, and a plan_hash. | calls [Plan a config file](https://docs.dispralabs.com/api/plan-a-config-file.md) |
| 2 | You | Review the plan: changes, objects the file leaves out (unmanaged) and warnings. |  |
| 3 | Your code | Applies with the plan_hash. If the environment changed since, apply refuses with plan_stale and the new plan. | calls [Apply a config file](https://docs.dispralabs.com/api/apply-a-config-file.md) |
| 4 | Dispra API | Runs the steps in order; a refused step stops the apply and reports what ran before it. |  |
| 5 | Dispra | Deploys every service that was created or changed. | logs [deploy.started](https://docs.dispralabs.com/events/deploy-started.md) |

## Related

- [Config as code](https://docs.dispralabs.com/features/config-as-code.md)
