Terraform Provider Softlayer

This is a provider for Terraform that lets you provision infrastructure on SoftLayer.
Alternatives To Terraform Provider Softlayer
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Upterm589
6 days ago48June 27, 202226apache-2.0Go
Secure Terminal Sharing
Provisioning305
2 months ago6mitHCL
Kubernetes cluster provisioning using Terraform.
Proxy Benchmarks210
a month ago2HCL
Benchmarks for several proxies
Terraform Provider Lxd209
a month ago31December 20, 202217mpl-2.0Go
LXD Resource provider for Terraform
Terraform Aws Ssh Bastion Service184
8 months agomitHCL
Terraform plan to deploy ssh bastion as a containerised, stateless service on AWS with IAM based authentication
Tf_aws_bastion_s3_keys180
2 years ago9apache-2.0HCL
A Terraform module for creating bastion host on AWS EC2 and populate its ~/.ssh/authorized_keys with public keys from bucket
Ops Cli180
19 days ago44October 14, 202118apache-2.0Python
Ops - cli wrapper for Terraform, Ansible, Helmfile and SSH for cloud automation
Terraform Aws Bastion173
4 months ago12apache-2.0HCL
Terraform module which creates SSH bastion infrastructure on AWS
Terraform Module Versions169
2 days ago26mitGo
CLI tool that checks Terraform code for module updates. Single binary, no dependencies. linux, osx, windows. #golang #cli #terraform
Terraform Azurerm Compute147
19 hours ago3mitHCL
Terraform Azure RM Compute Module
Alternatives To Terraform Provider Softlayer
Select To Compare


Alternative Project Comparisons
Readme

Terraform provider for SoftLayer

This is a terraform provider that lets you provision servers on SoftLayer via Terraform.

Build status: Build Status

Installing

Binaries are published on Bintray: Download

Copied from the Terraform documentation:

To install a plugin, put the binary somewhere on your filesystem, then configure Terraform to be able to find it. The configuration where plugins are defined is ~/.terraformrc for Unix-like systems and %APPDATA%/terraform.rc for Windows.

The binary should be renamed to terraform-provider-softlayer

You should update your .terraformrc and refer to the binary:

providers {
  softlayer = "/path/to/terraform-provider-softlayer"
}

A note about SSH keys

SoftLayer provisions SSH keys to new virtual servers only once during the creation of the virtual server. You can provision new SSH keys and assign them to the virtual server during the creation process, assign existing SSH keys by ID, or assign a combination of existing and newly provisioned SSH keys. Changing SSH keys assigned to a virtual server is not possible after it has already been created. It will need to be re-created. If you attempt to create a new SSH key using the softlayer_ssh_key resource type, and that key is already in the SoftLayer system, you will get an error stating that the key already exists. If this happens, use the Id of the existing SSH key as in the example below.

To get a list of existing SSH key Id's from SoftLayer, I recommend using the SoftLayer API Python Client. Once the client is setup, you can run the following command and get the existing SSH key Id's from the output:

[[email protected] ~]# slcli sshkey list
............
:........:...........:.................................................:..........................:
:   id   :   label   :                   fingerprint                   :          notes           :
:........:...........:.................................................:..........................:
: 123456 : test1-dev : xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx : Test Key 1               :
: 789101 : test2-dev : xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx : Test Key 2               :
:........:...........:.................................................:..........................:

Using the provider

Here is an example that will setup the following:

  • An SSH key resource.
  • A virtual server resource that uses an existing SSH key.
  • A virtual server resource using an existing SSH key and a Terraform managed SSH key (created as "test_key_1" in the example below).

(create this as sl.tf and run terraform commands from this directory):

provider "softlayer" {
    username = ""
    api_key = ""
}

# This will create a new SSH key that will show up under the \
# Devices>Manage>SSH Keys in the SoftLayer console.
resource "softlayer_ssh_key" "test_key_1" {
    name = "test_key_1"
    public_key = "${file(\"~/.ssh/id_rsa_test_key_1.pub\")}"
    # Windows Example:
    # public_key = "${file(\"C:\ssh\keys\path\id_rsa_test_key_1.pub\")}"
}

# Virtual Server created with existing SSH Key already in SoftLayer \
# inventory and not created using this Terraform template.
resource "softlayer_virtualserver" "myserver1" {
    name = "my_server_1"
    domain = "example.com"
    ssh_keys = ["123456"]
    image_type = "os_code"
    image = "DEBIAN_7_64"
    region = "ams01"
    public_network_speed = 10
    cpu = 1
    ram = 1024
}

# Virtual Server created with a mix of previously existing and \
# Terraform created/managed resources.
resource "softlayer_virtualserver" "myserver2" {
    name = "my_server_2"
    domain = "example.com"
    ssh_keys = ["123456", "${softlayer_ssh_key.test_key_1.id}"]
    image_type = "template_id"
    image = "dacf4db1-69a8-4bc8-bade-f51bd286c4df"
    region = "ams01"
    public_network_speed = 10
    cpu = 1
    ram = 1024
}

You'll need to provide your SoftLayer username and API key, so that Terraform can connect. If you don't want to put credentials in your configuration file, you can leave them out:

provider "softlayer" {}

...and instead set these environment variables:

  • SOFTLAYER_USERNAME: Your SoftLayer username
  • SOFTLAYER_API_KEY: Your API key

Building from source

  1. Install Go on your machine
  2. Set up Gopath
  3. git clone this repository into $GOPATH/src/github.com/finn-no/terraform-provider-softlayer
  4. Run go get to get dependencies
  5. Run go install to build the binary. You will now find the binary at $GOPATH/bin/terraform-provider-softlayer.

Releasing

  1. Update .bintray.json with the new version to be released (e.g. 0.1337), and the release date.
  2. Tag the release: git tag 0.1337
  3. Push the tag: git push --tags
  4. Travis CI will build and release the binaries.

Running

  1. You must create a new key not already added to softlayer (ssh-keygen). We will assume that is id_rsa.
  2. create the example file sl.tf in your working directory
  3. terraform plan
  4. terraform apply
  5. look up the public ip in the softlayer dashboard
  6. ssh -i ~/.ssh/id_rsa.pub [email protected]
Popular Terraform Projects
Popular Ssh Projects
Popular Configuration Management Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Golang
Ssh
Terraform
Ssh Key