github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/softlayer/index.html.markdown (about)

     1  ---
     2  layout: "softlayer"
     3  page_title: "Provider: SoftLayer"
     4  sidebar_current: "docs-softlayer-index"
     5  description: |-
     6    The Docker provider is used to interact with Docker containers and images.
     7  ---
     8  
     9  # SoftLayer Provider
    10  
    11  The SoftLayer provider is used to manage SoftLayer resources.
    12  
    13  Use the navigation to the left to read about the available resources.
    14  
    15  -> **Note:** The SoftLayer provider is new as of Terraform 0.6.16.
    16  It is ready to be used but many features are still being added. If there
    17  is a SoftLayer feature missing, please report it in the GitHub repo.
    18  
    19  ## Example Usage
    20  
    21  Here is an example that will setup the following:
    22  
    23  + An SSH key resource.
    24  + A virtual server resource that uses an existing SSH key.
    25  + A virtual server resource using an existing SSH key and a Terraform managed SSH key (created as `test_key_1` in the example below).
    26  
    27  Add the below to a file called `sl.tf` and run the `terraform` command from the same directory:
    28  
    29  ```hcl
    30  provider "softlayer" {
    31    username = ""
    32    api_key  = ""
    33  }
    34  
    35  # This will create a new SSH key that will show up under the \
    36  # Devices>Manage>SSH Keys in the SoftLayer console.
    37  resource "softlayer_ssh_key" "test_key_1" {
    38    name       = "test_key_1"
    39    public_key = "${file(\"~/.ssh/id_rsa_test_key_1.pub\")}"
    40  
    41    # Windows Example:
    42    # public_key = "${file(\"C:\ssh\keys\path\id_rsa_test_key_1.pub\")}"
    43  }
    44  
    45  # Virtual Server created with existing SSH Key already in SoftLayer \
    46  # inventory and not created using this Terraform template.
    47  resource "softlayer_virtual_guest" "my_server_1" {
    48    name                 = "my_server_1"
    49    domain               = "example.com"
    50    ssh_keys             = ["123456"]
    51    image                = "DEBIAN_7_64"
    52    region               = "ams01"
    53    public_network_speed = 10
    54    cpu                  = 1
    55    ram                  = 1024
    56  }
    57  
    58  # Virtual Server created with a mix of previously existing and \
    59  # Terraform created/managed resources.
    60  resource "softlayer_virtual_guest" "my_server_2" {
    61    name                 = "my_server_2"
    62    domain               = "example.com"
    63    ssh_keys             = ["123456", "${softlayer_ssh_key.test_key_1.id}"]
    64    image                = "CENTOS_6_64"
    65    region               = "ams01"
    66    public_network_speed = 10
    67    cpu                  = 1
    68    ram                  = 1024
    69  }
    70  ```
    71  
    72  You'll need to provide your SoftLayer username and API key,
    73  so that Terraform can connect. If you don't want to put
    74  credentials in your configuration file, you can leave them
    75  out:
    76  
    77  ```
    78  provider "softlayer" {}
    79  ```
    80  
    81  ...and instead set these environment variables:
    82  
    83  - **SOFTLAYER_USERNAME**: Your SoftLayer username
    84  - **SOFTLAYER_API_KEY**: Your API key