Skip to content

Commit

Permalink
[Datasource] Workspace NSG
Browse files Browse the repository at this point in the history
Update to 1.8.3
  • Loading branch information
michaelkad committed Oct 14, 2024
1 parent 62cb947 commit 44a52e7
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.22.5
require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20240926024252-81b3928fd062
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113
github.com/IBM-Cloud/power-go-client v1.8.1
github.com/IBM-Cloud/power-go-client v1.8.2
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca
github.com/IBM/appconfiguration-go-admin-sdk v0.3.0
github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240926024252-81b3928fd062/go.mod h1:/7h
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 h1:f2Erqfea1dKpaTFagTJM6W/wnD3JGq/Vn9URh8nuRwk=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
github.com/IBM-Cloud/power-go-client v1.8.1 h1:tx1aPJmIQrNru1MD1VHGNasGx3eRIs0zzPZ0KvdFQrg=
github.com/IBM-Cloud/power-go-client v1.8.1/go.mod h1:N4RxrsMUvBQjSQ/qPk0iMZ8zK+fZPRTnHi/gTaASw0g=
github.com/IBM-Cloud/power-go-client v1.8.2 h1:Lc0+14180tarUKsL30bGtkfHqxQAkGrWdXQsdKeyUQM=
github.com/IBM-Cloud/power-go-client v1.8.2/go.mod h1:UDyXeIKEp6r7yWUXYu3r0ZnFSlNZ2YeQTHwM2Tmlgv0=
github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw=
github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4=
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs=
Expand Down Expand Up @@ -1653,8 +1653,10 @@ github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
Expand Down
21 changes: 21 additions & 0 deletions ibm/service/power/data_source_ibm_pi_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ func DatasourceIBMPIWorkspace() *schema.Resource {
Description: "The Workspace crn.",
Type: schema.TypeString,
},
Attr_NetworkSecurityGroups: {
Computed: true,
Description: "Network security groups configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Attr_State: {
Computed: true,
Description: "The state of a Network Security Groups configuration.",
Type: schema.TypeString,
},
},
},
Type: schema.TypeList,
},
Attr_PowerEdgeRouter: {
Computed: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -132,6 +146,13 @@ func dataSourceIBMPIWorkspaceRead(ctx context.Context, d *schema.ResourceData, m
detailsData[Attr_PowerEdgeRouter] = []map[string]interface{}{wsPowerEdge}
wsDetails = append(wsDetails, detailsData)
}
if wsData.Details.NetworkSecurityGroups != nil {
wsNSG := map[string]interface{}{
Attr_State: *wsData.Details.NetworkSecurityGroups.State,
}
detailsData[Attr_NetworkSecurityGroups] = []map[string]interface{}{wsNSG}
wsDetails = append(wsDetails, detailsData)
}

d.Set(Attr_WorkspaceDetails, wsDetails)
wsLocation := map[string]interface{}{
Expand Down
21 changes: 21 additions & 0 deletions ibm/service/power/data_source_ibm_pi_workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ func DatasourceIBMPIWorkspaces() *schema.Resource {
Description: "The Workspace crn.",
Type: schema.TypeString,
},
Attr_NetworkSecurityGroups: {
Computed: true,
Description: "Network security groups configuration.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Attr_State: {
Computed: true,
Description: "The state of a Network Security Groups configuration.",
Type: schema.TypeString,
},
},
},
Type: schema.TypeList,
},
Attr_PowerEdgeRouter: {
Computed: true,
Elem: &schema.Resource{
Expand Down Expand Up @@ -142,6 +156,13 @@ func dataSourceIBMPIWorkspacesRead(ctx context.Context, d *schema.ResourceData,
detailsData[Attr_PowerEdgeRouter] = []map[string]interface{}{wsPowerEdge}
wsDetails = append(wsDetails, detailsData)
}
if ws.Details.NetworkSecurityGroups != nil {
wsNSG := map[string]interface{}{
Attr_State: *ws.Details.NetworkSecurityGroups.State,
}
detailsData[Attr_NetworkSecurityGroups] = []map[string]interface{}{wsNSG}
wsDetails = append(wsDetails, detailsData)
}

workspace := map[string]interface{}{
Attr_WorkspaceCapabilities: ws.Capabilities,
Expand Down
1 change: 1 addition & 0 deletions ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ const (
Attr_NetworkPorts = "network_ports"
Attr_Networks = "networks"
Attr_NetworkSecurityGroupID = "network_security_group_id"
Attr_NetworkSecurityGroups = "network_security_groups"
Attr_NumberOfVolumes = "number_of_volumes"
Attr_Onboardings = "onboardings"
Attr_OperatingSystem = "operating_system"
Expand Down
14 changes: 12 additions & 2 deletions website/docs/d/pi_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ description: |-
---

# ibm_pi_workspace

Retrieve information about your Power Systems account workspace.

## Example usage

```terraform
data "ibm_pi_workspace" "workspace" {
pi_cloud_instance_id = "99fba9c9-66f9-99bc-9999-aca999ee9d9b"
}
```

**Notes**
### 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`

Example usage:

```terraform
provider "ibm" {
region = "lon"
Expand All @@ -31,24 +35,30 @@ Example usage:
```

## Argument reference

Review the argument references that you can specify for your data source.

- `pi_cloud_instance_id` - (Required, String) Cloud Instance ID of a PCloud Instance under your account.

## Attribute reference

In addition to all argument reference listed, you can access the following attribute references after your data source is created.

- `id` - (String) Workspace ID.
- `pi_workspace_capabilities` - (Map) Workspace Capabilities. Capabilities are `true` or `false`.

Some of `pi_workspace_capabilities` are:
- `cloud-connections`, `power-edge-router`, `power-vpn-connections`, `transit-gateway-connection`
- `cloud-connections`, `power-edge-router`, `power-vpn-connections`, `transit-gateway-connection`

- `pi_workspace_details` - (List) Workspace information.

Nested schema for `pi_workspace_details`:
- `creation_date` - (String) Date of workspace creation.
- `crn` - (String) Workspace crn.
- `network_security_groups` - (List) Network security groups configuration.

Nested schema for `network_security_groups`:
- `state` - (String) The state of a network security groups configuration.
- `power_edge_router` - (List) Power Edge Router information.

Nested schema for `power_edge_router`:
Expand Down
30 changes: 20 additions & 10 deletions website/docs/d/pi_workspaces.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ description: |-
---

# ibm_pi_workspaces

Retrieve information about Power Systems workspaces.

## Example usage

```terraform
data "ibm_pi_workspaces" "workspaces" {
pi_cloud_instance_id = "99fba9c9-66f9-99bc-9999-aca999ee9d9b"
}
```

**Notes**
### 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`

Example usage:

```terraform
provider "ibm" {
region = "lon"
Expand All @@ -31,11 +35,13 @@ Example usage:
```

## Argument reference

Review the argument references that you can specify for your data source.

- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account.

## Attribute reference

In addition to all argument reference listed, you can access the following attribute references after your data source is created.

- `workspaces` - (List) List of all Workspaces.
Expand All @@ -50,19 +56,23 @@ In addition to all argument reference listed, you can access the following attri
Nested schema for `pi_workspace_details`:
- `creation_date` - (String) Date of workspace creation.
- `crn` - (String) Workspace crn.
- `power_edge_router` - (List) Power Edge Router information.
- `network_security_groups` - (List) Network security groups configuration.

Nested schema for `network_security_groups`:
- `state` - (String) The state of a network security groups configuration.
- `power_edge_router` - (List) Power Edge Router information.

Nested schema for `power_edge_router`:
- `migration_status` - (String) The migration status of a Power Edge Router.
- `status` - (String) The state of a Power Edge Router.
- `type` - (String) The Power Edge Router type.
Nested schema for `power_edge_router`:
- `migration_status` - (String) The migration status of a Power Edge Router.
- `status` - (String) The state of a Power Edge Router.
- `type` - (String) The Power Edge Router type.
- `pi_workspace_id` - (String) Workspace ID.
- `pi_workspace_location` - (Map) Workspace location.

Nested schema for `Workspace location`:
- `region` - (String) Workspace location region zone.
- `type` - (String) Workspace location region type.
- `url`- (String) Workspace location region url.
Nested schema for `Workspace location`:
- `region` - (String) Workspace location region zone.
- `type` - (String) Workspace location region type.
- `url`- (String) Workspace location region url.
- `pi_workspace_name` - (String) Workspace name.
- `pi_workspace_status` - (String) Workspace status, `active`, `critical`, `failed`, `provisioning`.
- `pi_workspace_type` - (String) Workspace type, `off-premises` or `on-premises`.

0 comments on commit 44a52e7

Please sign in to comment.