1

I'm trying to create a classic virtual server using terraform by following below two articles but I'm getting an error.

Articles

  1. https://cloud.ibm.com/docs/ibm-cloud-provider-for-terraform?topic=ibm-cloud-provider-for-terraform-getting-started

  2. https://cloud.ibm.com/docs/ibm-cloud-provider-for-terraform?topic=ibm-cloud-provider-for-terraform-sample_infrastructure_config

Error

Error: Error ordering virtual guest: Error generating order template: SoftLayer_Exception_Public: Access Denied. (HTTP 401)

provider.tf

terraform {
  required_providers {
    ibm = {
      source = "IBM-Cloud/ibm"
      version = "1.21.2"
    }
  }
}

variable "ibmcloud_api_key" {}
variable "iaas_classic_username" {}
variable "iaas_classic_api_key" {}

provider "ibm" {
  ibmcloud_api_key   = var.ibmcloud_api_key
  region             = "sng01"
  iaas_classic_username = var.iaas_classic_username
  iaas_classic_api_key  = var.iaas_classic_api_key
}

classic-vsi.tf

resource "ibm_compute_vm_instance" "vm1" {
hostname             = "vm1"
domain               = "testing.com"
os_reference_code    = "DEBIAN_8_64"
datacenter           = "sng01"
network_speed        = 10
hourly_billing       = true
private_network_only = false
cores                = 1
memory               = 1024
disks                = [25]
local_disk           = false
}

terraform.tfvars


ibmcloud_api_key = ""
iaas_classic_username = "emailID"
iaas_classic_api_key = ""

for iaas_classic_api_key I followed this article

for ibmcloud_api_key I followed this article

Is it possible to use terraform OR it is deprecated in favor of VPC2 Infrastructure?

Please help.

UPDATE

fixed the 401 error by replacing the value of iaas_classic_username from email-ID to IBM account six-digit unique ID. check the User-name by following the below article.

Reference article: https://cloud.ibm.com/docs/account?topic=account-vpnpassword

Now I'm getting the below error.

Error: Error ordering virtual guest: SoftLayer_Exception_Order_Item_Unavailable: Debian GNU/Linux 8.x jessie/Stable - Minimal Install (64 bit) is not available as of 09/12/2020 (Item #(6195). (HTTP 500)

metadata
  • 1,139
  • 1
  • 7
  • 28
  • Add details like your TF file. How did you authenticate? Access denied likely means that your configuration is wrong – data_henrik Mar 27 '21 at 12:38
  • @data_henrik I have added all the files I'm using. Please help. – metadata Mar 27 '21 at 14:54
  • And you get that error during "tf plan"? What commands have you used? – data_henrik Mar 27 '21 at 18:01
  • I would recommend that you provision a resource through the console first, then try to read it using TF. If that works in your environment, use TF to provision it. – data_henrik Mar 27 '21 at 18:02
  • yes @data_henrik error is comming when I'm running `terraform plan` command. Sure I'll try it using console first. – metadata Mar 30 '21 at 06:10
  • hello @data_henrik It seems that the value of `iaas_classic_username` isn't the email-ID. Now I'm using six digits unique ID(account-ID) in username and I'm not getting `401` error anymore but there are still some error like **`Error: Error ordering virtual guest: SoftLayer_Exception_Order_Item_Unavailable: Debian GNU/Linux 8.x jessie/Stable - Minimal Install (64 bit) is not available as of 09/12/2020 (Item #(6195). (HTTP 500)`**. Can you please help? – metadata Mar 30 '21 at 09:33
  • Use a different image name. Check what is available. – data_henrik Mar 30 '21 at 10:13
  • It seems that `DEBIAN_8_64` is deprecated and now the minimum version is `DEBIAN_9_64`. it's working fine after updating it to `DEBIAN_9_64`. Thanks a lot @data_henrik for helping me out. – metadata Mar 30 '21 at 10:41

1 Answers1

0

That error indicates that the OS image you are trying to order is no longer available. You will need to use Debian 9 or 10.

⇒  slcli vs create-options | grep -i 'Debian 9'
Debian 9.0.0-64 LAMP for VSI                                            OS_DEBIAN_9_X_STRETCH_LAMP_64_BIT                       DEBIAN_9_64
Debian 9.0.0-64 Minimal for VSI                                         OS_DEBIAN_9_X_STRETCH_MINIMAL_64_BIT                    DEBIAN_9_64

⇒  slcli vs create-options | grep -i 'Debian 10'
Debian 10.0.0-64 Minimal for VSI                                        OS_DEBIAN_10_X_BUSTER_MINIMAL_64_BIT_VSI                DEBIAN_10_64

If you had a specific need to use Jessie, you can use your own OS with a classic VSI. This guide outlines the process preparing a custom image for import.

On another note, you will want to use flavor_key_name in place of setting core and memory values directly. The core/memory combo is still supported by the Classic API but does not support new features like suspended billing and may be deprecated in the future.