2018

  • Using Same Terraform Template for Multiple Clouds

Using Same Terraform Template for Multiple Clouds

By Anton Isaiev and Svitlana Ostnek

Terraform is one of the most common automation tools for managing infrastructures in Cloud via Infrastructure as Code approach. The tool is widely used by EPAMers within their daily routine. Meanwhile, EPAM Cloud is the standard solution for virtual infrastructures provisioning. Naturally, a day came when the need to take the best of both solutuoins arose. Recently, EPAM Cloud team was addressed by one of the project's team, who shared their exiting solution: EPAM Cloud driver for Terraform! The new solution allows to manage virtual resources in any Cloud, supported by EPAM Orchestrator, in a unified manner, due to Maestro API usage:



Currently, the following resources related to the EPAM Cloud provider for Terraform are available:

To start using the provider, do the following:

  • 1. Add the provider binary file to ~/.terraform.d/plugins/.
  • 2. Specify the provider settings:
provider "epam" {
token = "${var.EPAM_TOKEN}"
id = "${var.EPAM_ID}"
}

Please note: the provider name and the name of the binary file are correlated. The initial binary file name is terraform-provider-epam , thus the provider name should be set as epam .

The current implementation supports the limited scope of operations, but the existing configuration is enough to run a VM.

Below, you can find an example of the provider usage by one of our colleagues who contributed the feature:

  • - The provider options are all specified in Go:
resource "epam_instance" "atg-app-server" { {
image = "${var.EPAM_IMAGE}"
project = "${var.EPAM_PROJEKT}"
region = "${var.EPAM_REGION}"
shape = "${var.EPAM_SHAPE}

This is enough to run an instance.

  • - There is also a part addressing config:
resource "epam_property" "prop" {
chefroles = ["base"]
project = "${var.epam_project}"
region = "${var.EPAM_REGION}"
... }
The EPAM Cloud Terraform provider is created by our colleagues and kindly shared with the Cloud community "as is". We warmly welcome any volunteers with Go experience who would like to contribute to the development of this feature. With any questions related to the subject and the possibility to contribute, please address EPAM Cloud Consulting team.