terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

ibm_pi_workspace: pi_plan is redundant?

Open sean-freeman opened this issue 11 months ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

all

Affected Resource(s)

  • ibm_pi_workspace

Terraform Configuration Files

resource "ibm_pi_workspace" "powervs_service_instance" {
  pi_name               = ""
  pi_datacenter         = ""
  pi_resource_group_id  = ""

  # https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/pi_workspace#pi_plan
  pi_plan               = "public" # public/private values accepted only
}

Expected Behavior

Should not require a plan, which is not shown on the Web GUI and has errors in the CLI (which itself only works with a plan name that does not exist).

[:~] $ ibmcloud resource service-instance-create NAME power-iaas public dal12
Creating service instance NAME in resource group Default of account Cloud Account as [email protected]...
FAILED
Service plan 'public' was not found.

[:~] $ ibmcloud resource service-instance-create NAME power-iaas private dal12
Creating service instance NAME in resource group Default of account Cloud Account as [email protected]...
FAILED
Service plan 'private' was not found.

[:~] $ ibmcloud resource service-instance-create test3 power-iaas power-virtual-server-group dal12
Creating service instance NAME in resource group Default of account Cloud Account as [email protected]...
OK
Service instance NAME was created.
[:~] $ ibmcloud catalog service power-iaas.workspace --global --output json | jq .[].metadata.plan
{
  "active": false,
  "bindable": false,
  "service_check_disabled": false
}

Actual Behavior

Steps to Reproduce

  1. terraform apply

References

/ibm/service/power/resource_ibm_pi_workspace.go#L48-L52

sean-freeman avatar Mar 20 '24 13:03 sean-freeman

FYI @surajsbharadwaj @powellquiring

sean-freeman avatar Mar 20 '24 13:03 sean-freeman

I still haven't used this resource as it had some issues before. I am still using the old one:

locals {
  service_type = "power-iaas"
  plan         = "power-virtual-server-group"
}

resource "ibm_resource_instance" "pi_workspace" {
  name              = var.pi_workspace_name
  service           = local.service_type
  plan              = local.plan
  location          = var.pi_zone
  resource_group_id = data.ibm_resource_group.resource_group_ds.id
  tags              = (var.pi_tags != null ? var.pi_tags : [])

  timeouts {
    create = "6m"
    update = "5m"
    delete = "10m"
  }
}

surajsbharadwaj avatar Mar 21 '24 10:03 surajsbharadwaj

on cli you need to use: ibmcloud pi workspace create dal10 -d dal10 -g 507a09dba6e341e78da0396f41e3b6b2 -p public

surajsbharadwaj avatar Mar 21 '24 10:03 surajsbharadwaj

@ismirlia could you try re-producing this issue?

yussufsh avatar Apr 29 '24 16:04 yussufsh

@michaelkad @rmoralesjr

yussufsh avatar May 14 '24 15:05 yussufsh

@sean-freeman The pi_plan isn't redundant; it's essential for establishing a workspace that accommodates both our public and private offerings. This was necessary due to our shift from a kind service to a composite one. Consequently, the workspace resource differs from the ibmcloud resource service-instance-create. While pi_workspace directly invokes the Resource Controller API to create a workspace, a modification was made to the RC SDK to support composite kind. As a result, both resources can now be used interchangeably to achieve the same outcome.

As @surajsbharadwaj mentioned, our CLI can be utilized to achieve the same functionality as opposed to ibmcloud resource.

on cli you need to use: ibmcloud pi workspace create dal10 -d dal10 -g 507a09dba6e341e78da0396f41e3b6b2 -p public

You example would be: $ ibmcloud resource service-instance-create NAME power-iaas power-virtual-server-group dal12 -g Default Rather than: $ ibmcloud resource service-instance-create NAME power-iaas public dal12

michaelkad avatar May 14 '24 18:05 michaelkad

@michaelkad How I read the explanation is, the service is now composite and using either value is the same outcome. Therefore in my opinion if this is truly the same outcome, it can be hardcoded to one or the other, and we can hide this evolution of the Power IaaS - simplify the experience for the end-user and avoid their confusion on something that is not described anywhere.

This should be all the end user should require:

resource "ibm_pi_workspace" "pi_workspace_instantiation" {
  pi_name               = ""
  pi_datacenter         = ""
  pi_resource_group_id  = ""
}

sean-freeman avatar May 14 '24 19:05 sean-freeman

@sean-freeman This will only work for public workspaces, and we won't have a method of discerning if the request is to create a workspace for private.

michaelkad avatar May 14 '24 20:05 michaelkad

@michaelkad how about setting pi_plan default value as public?

yussufsh avatar May 15 '24 04:05 yussufsh

@michaelkad Then provide the official documentation links for public vs. private IBM Power VS Workspaces

sean-freeman avatar May 15 '24 10:05 sean-freeman

@sean-freeman @yussufsh I will make a change to default it to public as external user will most likely only use that. The date of LA for private have been pushed, so that is use for internal purposes only for now. I will update the doc for public and private once we GA the LA.

I will update to this like you mentioned.

resource "ibm_pi_workspace" "pi_workspace_instantiation" {
  pi_name               = ""
  pi_datacenter         = ""
  pi_resource_group_id  = ""
}```

michaelkad avatar May 15 '24 14:05 michaelkad