# Importing Resources

The Import feature lets you bring existing cloud resources under MechCloud Stateless IaC management by converting the actual state into a desired state YAML template.

### Overview

If you have resources already running in your cloud account that were created manually (via console, CLI, or other tools), you can import them into MechCloud's Stateless IaC. The import reads the actual state of your resources and generates a desired state YAML that you can use as a starting point.

### How to Import

1. Navigate to **Infrastructure → Stateless IaC**
2. Select your **Team**, **Cloud Provider**, **Cloud Account**, **Context**, and **Region**
3. The **Actual State** panel on the right shows your current cloud resources
4. Click the **Import** button (arrow icon) in the Actual State panel header
5. MechCloud fetches the actual state and converts it into desired state YAML
6. The generated YAML appears in the **Desired State** editor on the left

### What Happens During Import

* MechCloud queries your cloud account for all resources in the selected context and region
* Resources are converted to the MechCloud YAML format with `snake_case` properties
* Cross-resource references are resolved to `ref:` syntax where possible
* The generated YAML is placed in the Desired State editor, replacing any existing content

### After Import

Once the desired state is populated:

1. **Review the YAML** — Check that all resources and properties look correct
2. **Click Plan** — Generate a plan to compare desired vs actual state
3. **Verify "none" actions** — All resources should show `action: none` since they already exist
4. **Customize** — Modify the YAML to add, update, or remove resources as needed
5. **Apply changes** — Use the normal Plan → Apply workflow for any modifications

### Use Cases

* **Adopting IaC for existing infrastructure** — Bring manually created resources under IaC management
* **Template generation** — Use import as a starting point for new templates based on existing setups
* **Disaster recovery** — Capture the current state as a template that can recreate the infrastructure

### Supported Providers

Import is available for all cloud providers that support Stateless IaC:

* **AWS**
* **Azure**
* **GCP**

### Limitations

* Import captures the current state at the time of import — it does not track ongoing changes
* Some provider-specific properties may not be fully captured (e.g., tags, metadata)
* The generated YAML may need manual adjustments for optimal readability
