A Terraform configuration for creating an IBM Cloud SSH Key (ibm_compute_ssh_key
). This will create a SSH key in the specified IBM cloud account. This is not a module, it is a terraform configuration that should be cloned or forked to be used.
This configuration template is written for IBM Cloud Provider version v0.4.0
Follow the instructions on the Getting Started with IBM Cloud Schematics documentation page.
You will need to setup up IBM Cloud provider credentials on your local machine. Then you will need the Terraform binary and the IBM Cloud Provider Plugin. Then follow the instructions at https://ibm-bluemix.github.io/tf-ibm-docs/v0.4.0/#developing-locally.
To run this project locally execute the following steps:
- Supply
datacenter
,public_key
,key_label
, andkey_note
variable values interraform.tfvars
, see https://www.terraform.io/intro/getting-started/variables.html#from-a-file for instructions.- Alternatively these values can be supplied via the command line or environment variables, see https://www.terraform.io/intro/getting-started/variables.html.
- Specifically for
public_key
material see "Generating a new SSH key and adding it to the ssh-agent") so that your workstation will use the key. terraform plan
: this will perform a dry run to show what infrastructure terraform intends to createterraform apply
: this will create actual infrastructure- Infrastructure can be seen in IBM Bluemix under the following URLs:
terraform destroy
: this will destroy all infrastructure which has been created
Any of these values is valid for use with the datacenter
variable:
ams01
: Amsterdam 1ams03
: Amsterdam 3che01
: Chennai 1dal01
: Dallas 1dal10
: Dallas 10dal12
: Dallas 12dal02
: Dallas 2dal05
: Dallas 5dal06
: Dallas 6dal07
: Dallas 7dal09
: Dallas 9fra02
: Frankfurt 2hkg02
: Hong Kong 2hou02
: Houston 2lon02
: London 2mel01
: Melbourne 1mex01
: Mexico 1mil01
: Milan 1mon01
: Montreal 1osl01
: Oslo 1par01
: Paris 1sjc01
: San Jose 1sjc03
: San Jose 3sao01
: Sao Paulo 1sea01
: Seattle 1seo01
: Seoul 1sng01
: Singapore 1syd01
: Sydney 1syd04
: Sydney 4tok02
: Tokyo 2tor01
: Toronto 1wdc01
: Washington 1wdc04
: Washington 4
Simply run terraform plan -var 'datacenter=lon02' -state=lon02.tfstate
or whatever your preferred datacenter is (replace lon02
for both arguments), and repeat for terraform apply
with the same arguments.
To setup the IBM Cloud provider to work with this example there are a few options for managing credentials safely; here we'll cover the preferred method using environment variables. Other methods can be used, please see the Terraform Getting Started Variable documentation for further details.
You'll need to export the following environment variables:
TF_VAR_bxapikey
- your Bluemix API KeyTF_VAR_slusername
- your Softlayer usernameTF_VAR_slapikey
- your Softlayer username
On OS X this is achieved by entering the following into your terminal, replacing the <value>
characters with the actual values (remove the <>
:
export TF_VAR_bxapikey=<value>
export TF_VAR_slusername=<value>
export TF_VAR_slapikey=<value>
However this is only temporary to your current terminal session, to make this permanent add these export statements to your ~/.profile
, ~/.bashrc
, ~/.bash_profile
or preferred terminal configuration file. If you go this route without running export ...
in your command prompt, you'll need to source your terminal configuration file from the command prompt like so: source ~/.bashrc
(or your preferred config file).
MIT; see LICENSE for details.