github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/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  <div class="alert alert-block alert-info">
    16  <strong>Note:</strong> The SoftLayer provider is new as of Terraform 0.X.
    17  It is ready to be used but many features are still being added. If there
    18  is a SoftLayer feature missing, please report it in the GitHub repo.
    19  </div>
    20  
    21  ## Example Usage
    22  
    23  Here is an example that will setup the following:
    24  + An SSH key resource.
    25  + A virtual server resource that uses an existing SSH key.
    26  + A virtual server resource using an existing SSH key and a Terraform managed SSH key (created as "test_key_1" in the example below).
    27  
    28  (create this as sl.tf and run terraform commands from this directory):
    29  
    30  ```hcl
    31  provider "softlayer" {
    32      username = ""
    33      api_key = ""
    34  }
    35  
    36  # This will create a new SSH key that will show up under the \
    37  # Devices>Manage>SSH Keys in the SoftLayer console.
    38  resource "softlayer_ssh_key" "test_key_1" {
    39      name = "test_key_1"
    40      public_key = "${file(\"~/.ssh/id_rsa_test_key_1.pub\")}"
    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