# Replicate Projects

Source: https://docs.ops0.com/docs/iac/replicate

Replicate an existing IaC project to a different cloud provider, region, or account. The Replication Wizard handles cross-cloud resource mapping, variable transformation, and backend configuration so you don't have to rewrite Terraform from scratch.

## Use Cases

| Scenario | Example |
|----------|---------|
| **Multi-cloud** | Replicate an AWS project to GCP for redundancy |
| **Disaster recovery** | Copy production infrastructure to a DR region |
| **Environment cloning** | Replicate production to create a staging environment |
| **Cloud migration** | Move infrastructure from one provider to another |

---

## Supported Cloud Providers

| Provider | As Source | As Target |
|----------|----------|-----------|
| **AWS** | Yes | Yes |
| **GCP** | Yes | Yes |
| **Azure** | Yes | Yes |
| **Oracle Cloud** | Yes | Yes |

Cross-cloud replication is supported in any direction (e.g., AWS → GCP, Azure → Oracle Cloud).

---

## Replication Wizard

### Select Source Project
Navigate to **IaC → Projects**, open the project you want to replicate, and click **Replicate**.

### Choose Target Cloud
Select the target cloud provider. ops0 displays the available integrations for that provider.

### Select Integration
Choose the cloud integration (credentials) for the target environment.

### Configure Backend
Set up the Terraform state backend for the new project:

| Backend | Configuration |
|---------|---------------|
| **S3** | Bucket, key, region, optional DynamoDB table |
| **GCS** | Bucket, prefix |
| **Azure Blob** | Resource group, storage account, container, key |

### Review Variable Transformations
ops0 automatically maps variables to the target cloud:

| Transformation | Example |
|---------------|---------|
| **Region mapping** | `us-east-1` → `us-central1` (GCP) |
| **Instance types** | `t3.medium` → `e2-medium` (GCP) |
| **Resource prefixes** | `aws-` → `gcp-` in naming |

Override any transformed values before proceeding.

### Configure GitHub (Optional)
Set up GitHub sync for the new project — choose repository, path, and branch.

### Review Policy Groups
Select which policy groups to attach to the replicated project. Groups from the source are pre-selected but can be toggled.

### Review Cost Estimate
The Replication Cost Assistant shows estimated monthly costs for the target environment before you proceed.

### Create
Click **Create** to generate the replicated project with transformed Terraform code.

---

## What Gets Replicated

| Included | Description |
|----------|-------------|
| **Terraform code** | All `.tf` files with cloud-specific transformations |
| **Variables** | Mapped and transformed for target cloud |
| **Variable definitions** | Types, descriptions, and sensitivity flags |
| **Policy groups** | Optional — select which groups to carry over |
| **GitHub config** | Optional — configure new repo path |

| Not Included | Why |
|-------------|-----|
| **State file** | New project starts with empty state |
| **Deployment history** | Fresh project, clean history |
| **Secrets** | Must be re-configured for security |

---

## Cross-Cloud Transformations

When replicating across cloud providers, ops0 automatically transforms resource references.

### Region Mapping

| AWS | GCP | Azure | Oracle Cloud |
|-----|-----|-------|-------------|
| us-east-1 | us-central1 | eastus | us-ashburn-1 |
| us-west-2 | us-west1 | westus2 | us-phoenix-1 |
| eu-west-1 | europe-west1 | westeurope | eu-frankfurt-1 |
| ap-southeast-1 | asia-southeast1 | southeastasia | ap-singapore-1 |

### Instance Type Mapping

| AWS | GCP | Azure | Oracle Cloud |
|-----|-----|-------|-------------|
| t3.micro | e2-micro | Standard_B1s | VM.Standard.E4.Flex (1 OCPU) |
| t3.small | e2-small | Standard_B1ms | VM.Standard.E4.Flex (1 OCPU) |
| t3.medium | e2-medium | Standard_B2s | VM.Standard.E4.Flex (2 OCPU) |
| t3.large | e2-standard-2 | Standard_B2ms | VM.Standard.E4.Flex (2 OCPU) |
| m5.xlarge | n2-standard-4 | Standard_D4s_v3 | VM.Standard.E4.Flex (4 OCPU) |

### Resource Name Prefixes

ops0 replaces cloud-specific prefixes in resource names:
- `aws-` ↔ `gcp-` ↔ `azure-` ↔ `oci-`

---

## After Replication

### Review Generated Code
Open the new project and review the transformed Terraform files.

### Configure Secrets
Add any sensitive values (API keys, passwords) that weren't carried over.

### Run Plan
Execute a Terraform plan to verify the code is valid for the target cloud.

### Deploy
Apply the infrastructure when you're satisfied with the plan output.

---

## Related

- [IaC Overview](https://docs.ops0.com/docs/iac/overview): IaC features including deployments, AI coding, and scheduling.

- [Variable Graph](https://docs.ops0.com/docs/iac/variable-graph): Visualize dependencies between projects and variables.

- [Migrate Engines](https://docs.ops0.com/docs/iac/migrate): Switch between Terraform and OpenTofu.
