ibm-cloud-architecture / terraform-icp-ibmcloud

This Terraform example configurations uses the IBM Cloud provider to provision virtual machines on IBM Cloud Infrastructure (SoftLayer) and TerraForm Module ICP Deploy to prepare VSIs and deploy IBM Cloud Private on them in Highly Available configuration. This Terraform template automates best practices learned from installing ICP on IBM Cloud Infrastructure.
12 stars 21 forks source link

Terraform plan or apply fails with 401 retrieving SSH Key caused by the March 25th changes #23

Open drewdouglass1 opened 5 years ago

drewdouglass1 commented 5 years ago

Received the error below using the most recent code available.

data.ibm_compute_ssh_key.public_key: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

* data.ibm_compute_ssh_key.public_key: 1 error(s) occurred:

* data.ibm_compute_ssh_key.public_key: data.ibm_compute_ssh_key.public_key: Error retrieving SSH key: SoftLayer_Exception_Public: Access Denied.  (HTTP 401)

I was able to fix this issue by updating the main.tf with:

provider "ibm" {
    softlayer_username = "${var.sl_username}"
    softlayer_api_key = "${var.sl_api_key}"
}

and the variables.tf with

variable "sl_username" { description = "IBM Cloud (aka SoftLayer) user name." }
variable "sl_api_key" { description = "IBM Cloud (aka SoftLayer) API key." }
jkwong888 commented 5 years ago

we don't recommend putting these values in variables.tf or terraform.tfvars as these can easily get committed into source control by mistake. we purposely removed these so that you won't get into that situation. instead, use the following environment variables before running the terraform:

export SL_USERNAME=<username>
export SL_API_KEY=<api key>
jkwong888 commented 5 years ago

btw, i did notice our documenation on this page says to put this stuff in terraform.tfvars and it's wrong. we will update the documentation.