Skip to content

Commit

Permalink
Add Crn attribute (#5107)
Browse files Browse the repository at this point in the history
* Add return crn attribute

* Update doc

* Update website/docs/d/pi_workspace.html.markdown

Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com>

* Update resource documents

* Add attribute to resource doc

* workspace attr

* Add Attr_CreationDate

* Resolve conflicts

* Add Attr_WorkspaceDetails in resource schema

* Update ibm/service/power/resource_ibm_pi_workspace_test.go

Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com>

* Update ibm/service/power/resource_ibm_pi_workspace_test.go

Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com>

* Update website/docs/r/pi_workspace.html.markdown

Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com>

---------

Co-authored-by: michaelkad <45772690+michaelkad@users.noreply.github.com>
  • Loading branch information
Diptipowervs and michaelkad committed Feb 29, 2024
1 parent 3c07f0b commit cf99ea3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 49 deletions.
12 changes: 12 additions & 0 deletions ibm/service/power/resource_ibm_pi_workspace.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
},
},
}
}
Expand Down Expand Up @@ -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
}
Expand Down
103 changes: 54 additions & 49 deletions 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.
---

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.

0 comments on commit cf99ea3

Please sign in to comment.