IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
341 stars 670 forks source link

Softlayer portal would show weight 0 if 'weight' is not specified in ibm_compute_autoscale_group #293

Closed erotallgeese closed 2 years ago

erotallgeese commented 6 years ago

Hi there,

Please check this problem. I'm upgrading from terraform-provider-ibm 0.8.0 to 0.10.0 I'm not sure whether it's correct or not and i have no idea how to test it.

Terraform Version

terraform 0.11.7 terraform-provider-ibm 0.10.0

Affected Resource(s)

main.tf

variable "softlayer_username" {
  description = "Your Bluemix Infrastructure (SoftLayer) user name."
}
variable "softlayer_api_key" {
  description = "Your Bluemix Infrastructure (SoftLayer) API key."
}

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

resource "ibm_compute_vm_instance" "vm0_qwer" {
  hostname                 = "vm0.qwer"
  domain                   = "example.com"
  datacenter               = "dal13"
  flavor_key_name          = "C1_1X1X25"
  os_reference_code        = "UBUNTU_16_64"
  local_disk               = "false"
  network_speed            = 100
  hourly_billing           = true
  private_network_only     = "true"
  dedicated_acct_host_only = false
}

resource "ibm_compute_vm_instance" "vm0_asdf" {
  hostname                 = "vm0.asdf"
  domain                   = "example.com"
  datacenter               = "dal13"
  flavor_key_name          = "C1_1X1X25"
  os_reference_code        = "UBUNTU_16_64"
  local_disk               = "false"
  network_speed            = 100
  hourly_billing           = true
  private_network_only     = "true"
  dedicated_acct_host_only = false
}

resource "ibm_lbaas" "loadbalance01" {
  name        = "loadbalance01"
  subnets     = ["${ibm_compute_vm_instance.vm0_asdf.private_subnet_id}"]
}

resource "ibm_lbaas_server_instance_attachment" "attachment_vm0_asdf" {
    private_ip_address  = "${ibm_compute_vm_instance.vm0_asdf.ipv4_address_private}"
    lbaas_id            = "${ibm_lbaas.loadbalance01.id}"
}

resource "ibm_lbaas_server_instance_attachment" "attachment_vm0_qwer" {
    private_ip_address  = "${ibm_compute_vm_instance.vm0_qwer.ipv4_address_private}"
    lbaas_id            = "${ibm_lbaas.loadbalance01.id}"
}

terraform.tfvar

softlayer_username = "ooxx"
softlayer_api_key = "ooxx"

Expected Behavior

This test could be done normally, but i found it would show all 0 weight in softlayer' portal site. I didn't specify weight because it's optional filed. As my thought, it should take average. (maybe i get wrong) I also test that the weight would still be 0 with only 1 vm instance.

In my application, i can't use count.index because the resource name seems could not been iterable. Do i need specify the weight by my own or any suggestions? Or it's just be fine?

Steps to Reproduce

terraform init terraform plan

Praveengostu commented 6 years ago

If you have not set the weight its fine with only one VM instance, and in portal it displays to default '0'.

hkantare commented 2 years ago

closing this due to no recent activity.Please feel to reopen a new issue