Technically Speaking

The Official Bigstep Blog

 

Terraform Support for Metal Cloud Now Available

Terraform is now supporting the Bigstep Metal Cloud. For all automation fans, you can now define infrastructure as code and manage the full lifecycle of bare metal servers via Terraform. We are among the exceptionally few providers that support bare metal with full automation support. If you are unfamiliar with Terraform, it is a powerful tool that allows you to provision and update cloud resources. We explain everything you need to know in this blog post.

Terraform is a free open-source infrastructure as code software tool that enables users to define and provision a data center infrastructure through the use of Hashicorp Configuration Language (HCL), or JSON. With Terraform you can safely and predictably make changes to your infrastructures.

Write a resource definition file describing your infrastructure, network, Firewall rules, etc. in Terraform, and hit:

terraform init

terraform apply

Since Terraform now also offers support for Metal Cloud, this is how the resource definition file looks like:

provider "metalcloud" {
  user_email = var.user_email
  api_key = var.api_key
  endpoint = var.endpoint
}


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

  network {
    network_type = "san"
    network_label = "san"
  }

  network {
    network_type = "wan"
    network_label = "internet"
  }


  network {
    network_type = "lan"
    network_label = "private"
  }

  instance_array {
    instance_array_label = "example-master"
    instance_array_instance_count = 2
    instance_array_ram_gbytes = 8
    instance_array_processor_count = 1
    instance_array_processor_core_count = 8

    interface {
      interface_index = 0
      network_label = "san"
    }

    interface {
      interface_index = 1
      network_label = "internet"
    }

    interface {
      interface_index = 2
      network_label = "private"
    }

    drive_array {
      drive_array_label = "example-master-os-drive"
      drive_array_storage_type = "iscsi_hdd"
      drive_size_mbytes_default = 49000
      volume_template_id = tonumber(data.metalcloud_volume_template.centos76.id)
    }

    firewall_rule {
      firewall_rule_description = "test fw rule"
      firewall_rule_port_range_start = 22
      firewall_rule_port_range_end = 22
      firewall_rule_source_ip_address_range_start="0.0.0.0"
      firewall_rule_source_ip_address_range_end="0.0.0.0"
      firewall_rule_protocol="tcp"
      firewall_rule_ip_address_type="ipv4"
    }
  }
}

Got a question? Need advice? We're just one click away.
Sharing is caring:TwitterFacebookLinkedinPinterestEmail

Readers also enjoyed:

Releasing a Brand New Metal Cloud CLI

We have just released our new Metal Cloud CLI, a new tool that will allow sysadmins to move a lot faster in working with metal cloud infrastructure…

The Ultimate Guide to Servers: Find the Best Solution for Your Business

Be it e-commerce, banking, machine learning or real-time analytics, your business depends on server performance and flexibility. Perhaps servers are too…

Leave a Reply

Your email address will not be published.

* Required fields to post your comments.
Please review our Privacy Notice in order to understand how we process your personal data and what are your rights in this respect.