diff --git a/ibm/service/power/resource_ibm_pi_workspace.go b/ibm/service/power/resource_ibm_pi_workspace.go index 590f6ac657..bdb0a24424 100644 --- a/ibm/service/power/resource_ibm_pi_workspace.go +++ b/ibm/service/power/resource_ibm_pi_workspace.go @@ -8,6 +8,7 @@ import ( st "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -50,6 +51,11 @@ func ResourceIBMPIWorkspace() *schema.Resource { ForceNew: true, Description: "Plan associated with the offering; Valid values are public or private.", }, + Attr_WorkspaceDetails: { + Computed: true, + Description: "Workspace information.", + Type: schema.TypeMap, + }, }, } } @@ -121,6 +127,12 @@ func resourceIBMPIWorkspaceRead(ctx context.Context, d *schema.ResourceData, met return diag.FromErr(err) } d.Set(PIWorkspaceName, controller.Name) + wsDetails := map[string]interface{}{ + Attr_CreationDate: controller.CreatedAt, + Attr_CRN: controller.TargetCRN, + } + + d.Set(Attr_WorkspaceDetails, flex.Flatten(wsDetails)) return nil } diff --git a/website/docs/r/pi_workspace.html.markdown b/website/docs/r/pi_workspace.html.markdown index b17e5ca2a4..2f3ae69fd3 100644 --- a/website/docs/r/pi_workspace.html.markdown +++ b/website/docs/r/pi_workspace.html.markdown @@ -1,49 +1,54 @@ ---- - -subcategory: "Power Systems" -layout: "ibm" -page_title: "IBM: pi_workspace" -description: |- - Manages a workspace in the Power Virtual Server cloud. ---- - -# ibm_pi_workspace - -Create or Delete a PowerVS Workspace - -## Example usage - -```terraform -data "ibm_resource_group" "group" { - name = "test" -} - -resource "ibm_pi_workspace" "powervs_service_instance" { - pi_name = "test-name" - pi_datacenter = "us-east" - pi_resource_group_id = data.ibm_resource_group.group.id - pi_plan = "public" -} -``` - -## Notes - -- Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. -- If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: - - `region` - `lon` - - `zone` - `lon04` - -## Argument reference - -Review the argument references that you can specify for your resource. - -- `pi_name` - (Required, String) A descriptive name used to identify the workspace. -- `pi_datacenter` - (Required, String) Target location or environment to create the resource instance. -- `pi_resource_group_id` - (Required, String) The ID of the resource group where you want to create the workspace. You can retrieve the value from data source `ibm_resource_group`. -- `pi_plan` - (Required, String) Plan associated with the offering; Valid values are `public` or `private`. - -## Attribute reference - -In addition to all argument reference listed, you can access the following attribute references after your resource source is created. - -- `id` - (String) Workspace ID. \ No newline at end of file +--- + +subcategory: "Power Systems" +layout: "ibm" +page_title: "IBM: pi_workspace" +description: |- + Manages a workspace in the Power Virtual Server cloud. +--- + +# ibm_pi_workspace + +Create or Delete a PowerVS Workspace + +## Example usage + +```terraform +data "ibm_resource_group" "group" { + name = "test" +} + +resource "ibm_pi_workspace" "powervs_service_instance" { + pi_name = "test-name" + pi_datacenter = "us-east" + pi_resource_group_id = data.ibm_resource_group.group.id + pi_plan = "public" +} +``` + +## Notes + +- Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. +- If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: + - `region` - `lon` + - `zone` - `lon04` + +## Argument reference + +Review the argument references that you can specify for your resource. + +- `pi_name` - (Required, String) A descriptive name used to identify the workspace. +- `pi_datacenter` - (Required, String) Target location or environment to create the resource instance. +- `pi_resource_group_id` - (Required, String) The ID of the resource group where you want to create the workspace. You can retrieve the value from data source `ibm_resource_group`. +- `pi_plan` - (Required, String) Plan associated with the offering; Valid values are `public` or `private`. + +## Attribute reference + +In addition to all argument reference listed, you can access the following attribute references after your resource source is created. + +- `id` - (String) Workspace ID. +- `workspace_details` - (Map) Workspace information. + + Nested schema for `workspace_details`: + - `creation_date` - (String) Date of workspace creation. + - `crn` - (String) Workspace crn. \ No newline at end of file