Terraform overview
What is the Terraform provider?
In addition to its REST API, ECI provides an official Terraform provider, elice-dev/eci. It lets you declaratively define and version-control VMs, block storage, networks, and public IPs.
- Official registry: registry.terraform.io/providers/elice-dev/eci
- Source: github.com/elice-dev/terraform-provider-eci
Do not use the OpenStack provider
ECI is not OpenStack-compatible. Use elice-dev/eci above, not terraform-provider-openstack.
Prerequisites
- Terraform 1.0 or higher installed
- A user access token: issue one from Admin > User Access Tokens in the portal (expires in 30/90 days or 6/12 months)
- A zone ID: the UUID of the zone to deploy VMs in. Get it from Infrastructure > Zones in the portal, or via the
eci_zonedata source
Provider configuration
# versions.tf
terraform {
required_version = ">= 1.0"
required_providers {
eci = {
source = "elice-dev/eci"
}
}
}
# provider.tf
provider "eci" {
api_endpoint = "https://portal.elice.cloud/api"
api_access_token = var.api_access_token # inject via env var or tfvars
zone_id = var.zone_id
}
| Field | Description |
|---|---|
api_endpoint | Portal API URL. Commercial zone: https://portal.elice.cloud/api; public zone: https://portal.gov.elice.cloud/api; integrated organizations: https://<organization>.elice.io/api |
api_access_token | Required. Access token issued from the portal. The environment variable TF_VAR_api_access_token is recommended |
zone_id | Required. UUID of the zone resources will be placed in |
Do not commit the token
Inject api_access_token through a .tfvars (gitignored) file or an environment variable. If a token is committed, delete it from the portal immediately.
Main resources and data sources
| Resource | Description |
|---|---|
eci_virtual_machine | VM definition (specs, name, credentials) |
eci_virtual_machine_allocation | Allocates the VM to a host and starts it |
eci_block_storage | Block storage (OS disk or data disk) |
eci_block_storage_snapshot | Block storage snapshot |
eci_virtual_network | Virtual network |
eci_subnet | Subnet |
eci_network_interface | Network interface |
eci_public_ip | Public IP |
| Data source | Description |
|---|---|
eci_zone | Look up a zone |
eci_region | Look up a region |
eci_instance_type | Instance type (name → UUID) |
eci_pricing | Pricing (name + pricing_type) |
eci_block_storage_image | OS image |
For the full schema of each resource, see the official provider docs.
Next steps
- Quickstart — first VM from creation to SSH
- Cheatsheet — frequently used commands and patterns
- Spot VM — automated provisioning at spot pricing