Skip to content
This repository has been archived by the owner. It is now read-only.
Go to file
Cannot retrieve contributors at this time
87 lines (64 sloc) 2.5 KB
layout page_title description
Metalcloud: Getting started
Getting started guide with the metalcloud provider.

Metalcloud: Getting started

The Bigstep Metalcloud provider allows users to provision bare metal resources such as physical servers, switch condigurations, iSCSI drives etc.

Provisioning a server

To provision a server:

# Configure the metalcloud provider
provider "metalcloud" {
   user_email = var.user_email
   api_key = var.api_key 
   endpoint = var.endpoint

# Identity the ID of the volume template we want
data "metalcloud_volume_template" "centos76" {
  volume_template_label = "centos7-6"

resource "metalcloud_infrastructure" "my-infra102" {
  infrastructure_label = "my-terraform-infra102"
  datacenter_name = var.datacenter

  # Remove this to actually deploy changes, otherwise all changes will remain in edit mode only.
  prevent_deploy = true 
  instance_array {
    # Name of your cluster. Needs to obey DNS rules as it will translate into a DNS record.
    instance_array_label = "web-servers"

    instance_array_instance_count = 1
    instance_array_ram_gbytes = 8
    instance_array_processor_count = 1
    instance_array_processor_core_count = 8

      drive_array_label = "web-servers-centos"
      drive_array_storage_type = "iscsi_hdd"

      # The size of the drive array in MBytes
      drive_size_mbytes_default = 49000

      # The id of the template we located earlier
      volume_template_id = tonumber(

    #one or more FW rules. By default all traffic is denied so we need at least one entry.
    firewall_rule {
      firewall_rule_description = "test fw rule"
      firewall_rule_port_range_start = 22
      firewall_rule_port_range_end = 22


Getting the API Key is typically done via the Bigstep Metal Cloud's API key section. Use it with a -var or as an env variable:

export TF_VAR_api_key="<yourkey>"
export TF_VAR_user=""
export TF_VAR_endpoint=""
export TF_VAR_datacenter="uk-reading"
terraform plan

!> Warning: Hard-coding credentials into any Terraform configuration is not recommended, and risks secret leakage should this file ever be committed to a public version control system.

You can’t perform that action at this time.