Subscribed unsubscribe Subscribe Subscribe

Terraform "officially" supported Arukas!!

f:id:febc_yamamoto:20170111214425p:plain
The Arukas provider was added in Terraform v0.8.7.
In this article, I will introduce from how to sign up for Arukas.io to how to use it on Terraform.

What’s Arukas?

Arukas is a Docker hosting service.
arukas.io And is explained on the official website as follows.

Arukas is the simplest-to-use Container-as-a-service that makes it easy to deploy and manage apps at scale.

Arukas’s Key features

Arukas’s Key features are introduced on the official website.
Among them, I think the following two features are particularly useful:

  • Allocate the third-party accessible endpoint
  • Easy to Scale out

There are explained on the official website as follows.

Allocate the third-party accessible endpoint

All applications starts with their own end-point ( *.arukascloud.io ) that allows the third-party access.
You can customise the subdomain as you would like.

Easy to Scale out

Arukas is designed to help you operate at scale.
The robust and reliable infrastructure needed to cope with the scalability is available on demand.

For details on other key features, please see the official website.
Now, let’s look at how to use Arukas.

How to sign up for Arukas.io

Current how to sign up is described on following page of the official website.

arukas.io

There are two ways to sign up.

  • 1) Use E-Mail
  • 2) Use Github account(OAuth)

Please choose the one you like.
Currently it seems that the account will be activated in about one week.

How to generate API key

When sign up is completed, access the Arukas control panel from the following URL.

https://app.arukas.io/

First, generate API key as shown in the screenshot below.

f:id:febc_yamamoto:20170111201857p:plain
f:id:febc_yamamoto:20170111201902p:plain

Now, API key is generated and displayed on the screen as following.

f:id:febc_yamamoto:20170111201908p:plain

Please keep these for future use.

How to use Arukas with Terraform

Now, Let’s use Arukas from Terraform.

First, install terraform according to following installation guide.

www.terraform.io

Next, create *.tf file.
The entire configuration is shown below. Save the contents to a file named example.tf.

provider "arukas" {
    token = "API_TOKEN_HERE"
    secret = "API_SECRET_HERE"
}

resource "arukas_container" "foobar" {
    name = "terraform_for_arukas_test_foobar"
    image = "nginx:latest"
    instances = 1
    memory = 256
    ports = {
        protocol = "tcp"
        number = "80"
    }
    environments {
        key = "key1"
        value = "value1"
    }
}

Replace the API_TOKEN_HERE and API_SECRET_HERE with your Arukas API key.

Incidentally, documentation of arukas resources on terraform is on the following page.

www.terraform.io

Next , Run terraform apply in the same directory as your example.tf, and watch it go!

It will take a few minutes since Terraform waits for the Arukas container to become available.

$ terraform apply
arukas_container.foobar: Creating...
  app_id:                 "" => "<computed>"
  endpoint:               "" => "<computed>"
  endpoint_full_hostname: "" => "<computed>"
  endpoint_full_url:      "" => "<computed>"
  environments.#:         "" => "1"
  environments.0.key:     "" => "key1"
  environments.0.value:   "" => "value1"
  image:                  "" => "nginx:latest"
  instances:              "" => "1"
  memory:                 "" => "256"
  name:                   "" => "terraform_for_arukas_test_foobar"
  port_mappings.#:        "" => "<computed>"
  ports.#:                "" => "1"
  ports.0.number:         "" => "80"
  ports.0.protocol:       "" => "tcp"
arukas_container.foobar: Still creating... (10s elapsed)
...

arukas_container.foobar: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

...

Done! Now,looking at the Arukas control panel, you should be able to confirm that the container is created.
When you access the URL of the endpoint, the default page of NGINX should be displayed.

The basic usage is over.
Please run various containers and enjoy on Arukas!

Conclusion

Arukas is in beta testing until April 2017.
Until then it is completely FREE to use, so let’s use it now!