# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mechcloud.io/cloud-computing/stateless-iac/importing-resources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
