# Environment model

> An environment is the target into which a server or resource is provisioned, and the model that ties a resource handler to the groups, images, and parameters associated with it

---

Site [llms.txt](/llms.txt)

---

An environment is an instance of `infrastructure.models.Environment`. It carries a single optional `resource_handler`, so one environment represents one slice of one cloud or data center.

![Diagram of an environment and the objects it relates to.](/img/cmp/developer-resources/guide/models/environments/environment-object-model.png)

## What an environment links to

Some of these links live on the environment, others on the related object.

| Related to | Where the link lives |
| --- | --- |
| Resource handler | `Environment.resource_handler`, a single foreign key. |
| Groups | On the group, as `Group.environments`, labeled Available Environments. An empty list means the group is not constrained to particular environments. |
| Servers | `Server.environment`, protected. An environment with servers cannot be deleted. |
| OS Builds | On the build, as `OSBuild.environments`, which sets where the build is offered. Read it back from an environment as `environment.os_builds`. |
| Networks | Networks are `ResourceNetwork` objects, sub-typed per technology. An environment links to them through the options of the NET-type parameters `sc_nic_0` through `sc_nic_9`. An option is offered only when the resource handler has it and the group or environment also allows it. |
| Parameters | `custom_fields` for the parameters that apply, and `custom_field_options` for their allowed values. The resource handler determines which technology parameters appear, so changing the handler clears their values. |
| Preconfigurations | `preconfigurations` for the preconfigurations offered in this environment, and `preconfiguration_options` for their allowed value sets. |
| Provision engine, container orchestrator | The optional foreign keys `provision_engine` and `container_orchestrator`, for environments that provision through something other than the resource handler. |
| Data center, resource pool | The optional foreign keys `data_center` and `resource_pool`, which describe where in the provider the environment sits. |
| Tenant | `tenant` scopes the environment in a multi-tenant deployment. |
| Quotas | `quota_set`, required. Every environment is created with an empty quota set. |

Two fields override behavior set elsewhere:

- `auto_approval`, labeled Auto approve all orders, marks the environment as auto-approving, and an order skips review when every one of its items lands in an environment like this.
- `rate_currency_unit` overrides the global currency for this environment's rates.

## Related

- [Environments](/docs/cmp/configure/infrastructure/environments/): Create and configure environments.
- [Resource handler model](/docs/cmp/developer-resources/guide/models/resource-handlers/): The model behind the handler.
- [Environment-level parameters](/docs/cmp/use/blueprints/customize-order-form/group-and-environment-parameters/): Set parameters and allowed values.
