Skip to content

Commit 82aad7a

Browse files
committed
[Datasource] Workspace NSG update
1 parent 2aa2176 commit 82aad7a

File tree

7 files changed

+81
-24
lines changed

7 files changed

+81
-24
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.22.5
77
require (
88
github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be
99
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113
10-
github.com/IBM-Cloud/power-go-client v1.7.0
10+
github.com/IBM-Cloud/power-go-client v1.8.0-beta17
1111
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca
1212
github.com/IBM/appconfiguration-go-admin-sdk v0.3.0
1313
github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be/go.mod h1:/7h
118118
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 h1:f2Erqfea1dKpaTFagTJM6W/wnD3JGq/Vn9URh8nuRwk=
119119
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
120120
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
121-
github.com/IBM-Cloud/power-go-client v1.7.0 h1:/GuGwPMTKoCZACfnwt7b6wKr4v32q1VO1AMFGNETRN4=
122-
github.com/IBM-Cloud/power-go-client v1.7.0/go.mod h1:9izycYAmNQ+NAdVPXDC3fHYxqWLjlR2YiwqKYveMv5Y=
121+
github.com/IBM-Cloud/power-go-client v1.8.0-beta17 h1:zL/qQUs/bb8L0FEazcBcpr7wTCpv0CJp/dbpg6351Qc=
122+
github.com/IBM-Cloud/power-go-client v1.8.0-beta17/go.mod h1:oAkZiHX25cmr2Yun5V0q6CpnUemegvSrpcEy/oQcjzU=
123123
github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw=
124124
github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4=
125125
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs=
@@ -138,8 +138,6 @@ github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTp
138138
github.com/IBM/container-registry-go-sdk v1.1.0/go.mod h1:4TwsCnQtVfZ4Vkapy/KPvQBKFc3VOyUZYkwRU4FTPrs=
139139
github.com/IBM/continuous-delivery-go-sdk v1.6.0 h1:eAL/jIWHrDFlWDF+Qd9Y5UN99Pr5Mjd/H/bvTbXUbz4=
140140
github.com/IBM/continuous-delivery-go-sdk v1.6.0/go.mod h1:nZdKUnubXNLo+zo28R4Rd+TGDqiJ/xoE8WO/A3kLw1E=
141-
github.com/IBM/event-notifications-go-admin-sdk v0.8.0 h1:xk2CYTayQtKi6LSgGGFRxFJfWUxyM5SY8Rs64ducAhw=
142-
github.com/IBM/event-notifications-go-admin-sdk v0.8.0/go.mod h1:OByvqfrNVxs7G6ggv8pwQCEVw10/TBJCLh7NM3z707w=
143141
github.com/IBM/event-notifications-go-admin-sdk v0.9.0 h1:eaCd+GkxhNyot+8rA9WkAQdlVYrRD20LYiXjEytFO6M=
144142
github.com/IBM/event-notifications-go-admin-sdk v0.9.0/go.mod h1:OByvqfrNVxs7G6ggv8pwQCEVw10/TBJCLh7NM3z707w=
145143
github.com/IBM/eventstreams-go-sdk v1.4.0 h1:yS/Ns29sBOe8W2tynQmz9HTKqQZ0ckse4Py5Oy/F2rM=
@@ -187,8 +185,6 @@ github.com/IBM/scc-go-sdk/v5 v5.4.1 h1:RXIuxOo9/hxkWyHCI69ae+KIJgSbXcAkJwTEl+fO3
187185
github.com/IBM/scc-go-sdk/v5 v5.4.1/go.mod h1:2xQTDgNXG5QMEfQxBDKB067z+5ha6OgcaKCTcdGDAo8=
188186
github.com/IBM/schematics-go-sdk v0.2.3 h1:lgTt0Sbudii3cuSk1YSQgrtiZAXDbBABAoVj3eQuBrU=
189187
github.com/IBM/schematics-go-sdk v0.2.3/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ=
190-
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.5 h1:VMc/Zd6RzB8j60CqZekkwYT2wQsCfrkGV2n01Gviuaw=
191-
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.5/go.mod h1:5kUgJ1dG9cdiAcPDqVz46m362bPnoqZQSth24NiowSg=
192188
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.6 h1:bF6bAdI4wDZSje6+Yx1mJxvirboxO+uMuKhzgfRCNxE=
193189
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.6/go.mod h1:XWYnbcc5vN1RnKwk/fCzfD8aZd7At/Y1/b6c+oDyliU=
194190
github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w9M=

ibm/service/power/data_source_ibm_pi_workspace.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ func DatasourceIBMPIWorkspace() *schema.Resource {
4949
Description: "The Workspace crn.",
5050
Type: schema.TypeString,
5151
},
52+
Attr_NetworkSecurityGroups: {
53+
Computed: true,
54+
Description: "Network security groups configuration.",
55+
Elem: &schema.Resource{
56+
Schema: map[string]*schema.Schema{
57+
Attr_State: {
58+
Computed: true,
59+
Description: "The state of a Network Security Groups configuration.",
60+
Type: schema.TypeString,
61+
},
62+
},
63+
},
64+
Type: schema.TypeList,
65+
},
5266
Attr_PowerEdgeRouter: {
5367
Computed: true,
5468
Elem: &schema.Resource{
@@ -132,6 +146,13 @@ func dataSourceIBMPIWorkspaceRead(ctx context.Context, d *schema.ResourceData, m
132146
detailsData[Attr_PowerEdgeRouter] = []map[string]interface{}{wsPowerEdge}
133147
wsDetails = append(wsDetails, detailsData)
134148
}
149+
if wsData.Details.NetworkSecurityGroups != nil {
150+
wsNSG := map[string]interface{}{
151+
Attr_State: *wsData.Details.NetworkSecurityGroups.State,
152+
}
153+
detailsData[Attr_NetworkSecurityGroups] = []map[string]interface{}{wsNSG}
154+
wsDetails = append(wsDetails, detailsData)
155+
}
135156

136157
d.Set(Attr_WorkspaceDetails, wsDetails)
137158
wsLocation := map[string]interface{}{

ibm/service/power/data_source_ibm_pi_workspaces.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ func DatasourceIBMPIWorkspaces() *schema.Resource {
5454
Description: "The Workspace crn.",
5555
Type: schema.TypeString,
5656
},
57+
Attr_NetworkSecurityGroups: {
58+
Computed: true,
59+
Description: "Network security groups configuration.",
60+
Elem: &schema.Resource{
61+
Schema: map[string]*schema.Schema{
62+
Attr_State: {
63+
Computed: true,
64+
Description: "The state of a Network Security Groups configuration.",
65+
Type: schema.TypeString,
66+
},
67+
},
68+
},
69+
Type: schema.TypeList,
70+
},
5771
Attr_PowerEdgeRouter: {
5872
Computed: true,
5973
Elem: &schema.Resource{
@@ -142,6 +156,13 @@ func dataSourceIBMPIWorkspacesRead(ctx context.Context, d *schema.ResourceData,
142156
detailsData[Attr_PowerEdgeRouter] = []map[string]interface{}{wsPowerEdge}
143157
wsDetails = append(wsDetails, detailsData)
144158
}
159+
if ws.Details.NetworkSecurityGroups != nil {
160+
wsNSG := map[string]interface{}{
161+
Attr_State: *ws.Details.NetworkSecurityGroups.State,
162+
}
163+
detailsData[Attr_NetworkSecurityGroups] = []map[string]interface{}{wsNSG}
164+
wsDetails = append(wsDetails, detailsData)
165+
}
145166

146167
workspace := map[string]interface{}{
147168
Attr_WorkspaceCapabilities: ws.Capabilities,

ibm/service/power/ibm_pi_constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ const (
398398
Attr_WorkspaceStatus = "pi_workspace_status"
399399
Attr_WorkspaceType = "pi_workspace_type"
400400
Attr_WWN = "wwn"
401+
Attr_NetworkSecurityGroups = "network_security_groups"
401402

402403
// Duplicate Attributes, will be removed as refactoring take course.
403404
PICloudConnectionClassicGreSource = "gre_source_address"

website/docs/d/pi_workspace.html.markdown

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ description: |-
77
---
88

99
# ibm_pi_workspace
10+
1011
Retrieve information about your Power Systems account workspace.
1112

1213
## Example usage
14+
1315
```terraform
1416
data "ibm_pi_workspace" "workspace" {
1517
pi_cloud_instance_id = "99fba9c9-66f9-99bc-9999-aca999ee9d9b"
1618
}
1719
```
1820

19-
**Notes**
21+
### Notes
22+
2023
- Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints.
2124
- If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows:
2225
- `region` - `lon`
2326
- `zone` - `lon04`
2427

2528
Example usage:
29+
2630
```terraform
2731
provider "ibm" {
2832
region = "lon"
@@ -31,11 +35,13 @@ Example usage:
3135
```
3236

3337
## Argument reference
38+
3439
Review the argument references that you can specify for your data source.
3540

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

3843
## Attribute reference
44+
3945
In addition to all argument reference listed, you can access the following attribute references after your data source is created.
4046

4147
- `id` - (String) Workspace ID.
@@ -49,12 +55,15 @@ In addition to all argument reference listed, you can access the following attri
4955
Nested schema for `pi_workspace_details`:
5056
- `creation_date` - (String) Date of workspace creation.
5157
- `crn` - (String) Workspace crn.
58+
- `network_security_groups` - (List) Network security groups configuration.
59+
Nested schema for `network_security_groups`:
60+
- `state` - (String) The state of a network security groups configuration.
5261
- `power_edge_router` - (List) Power Edge Router information.
5362

5463
Nested schema for `power_edge_router`:
55-
- `migration_status` - (String) The migration status of a Power Edge Router.
56-
- `status` - (String) The state of a Power Edge Router.
57-
- `type` - (String) The Power Edge Router type.
64+
- `migration_status` - (String) The migration status of a Power Edge Router.
65+
- `status` - (String) The state of a Power Edge Router.
66+
- `type` - (String) The Power Edge Router type.
5867
- `pi_workspace_location` - (Map) Workspace location.
5968

6069
Nested schema for `Workspace location`:

website/docs/d/pi_workspaces.html.markdown

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ description: |-
77
---
88

99
# ibm_pi_workspaces
10+
1011
Retrieve information about Power Systems workspaces.
1112

1213
## Example usage
14+
1315
```terraform
1416
data "ibm_pi_workspaces" "workspaces" {
1517
pi_cloud_instance_id = "99fba9c9-66f9-99bc-9999-aca999ee9d9b"
1618
}
1719
```
1820

19-
**Notes**
21+
### Notes
22+
2023
- Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints.
2124
- If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows:
2225
- `region` - `lon`
2326
- `zone` - `lon04`
2427

2528
Example usage:
29+
2630
```terraform
2731
provider "ibm" {
2832
region = "lon"
@@ -31,38 +35,43 @@ Example usage:
3135
```
3236

3337
## Argument reference
38+
3439
Review the argument references that you can specify for your data source.
3540

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

3843
## Attribute reference
44+
3945
In addition to all argument reference listed, you can access the following attribute references after your data source is created.
4046

4147
- `workspaces` - (List) List of all Workspaces.
4248
Nested schema for `workspaces`
4349
- `pi_workspace_capabilities` - (Map) Workspace Capabilities. Capabilities are `true` or `false`.
4450

4551
Some of `pi_workspace_capabilities` are:
46-
- `cloud-connections`, `power-edge-router`, `power-vpn-connections`, `transit-gateway-connection`
52+
- `cloud-connections`, `power-edge-router`, `power-vpn-connections`, `transit-gateway-connection`
4753

4854
- `pi_workspace_details` - (List) Workspace information.
4955

5056
Nested schema for `pi_workspace_details`:
51-
- `creation_date` - (String) Date of workspace creation.
52-
- `crn` - (String) Workspace crn.
53-
- `power_edge_router` - (List) Power Edge Router information.
54-
55-
Nested schema for `power_edge_router`:
56-
- `migration_status` - (String) The migration status of a Power Edge Router.
57-
- `status` - (String) The state of a Power Edge Router.
58-
- `type` - (String) The Power Edge Router type.
57+
- `creation_date` - (String) Date of workspace creation.
58+
- `crn` - (String) Workspace crn.
59+
- `network_security_groups` - (List) Network security groups configuration.
60+
Nested schema for `network_security_groups`:
61+
- `state` - (String) The state of a network security groups configuration.
62+
- `power_edge_router` - (List) Power Edge Router information.
63+
64+
Nested schema for `power_edge_router`:
65+
- `migration_status` - (String) The migration status of a Power Edge Router.
66+
- `status` - (String) The state of a Power Edge Router.
67+
- `type` - (String) The Power Edge Router type.
5968
- `pi_workspace_id` - (String) Workspace ID.
6069
- `pi_workspace_location` - (Map) Workspace location.
6170

6271
Nested schema for `Workspace location`:
63-
- `region` - (String) Workspace location region zone.
64-
- `type` - (String) Workspace location region type.
65-
- `url`- (String) Workspace location region url.
72+
- `region` - (String) Workspace location region zone.
73+
- `type` - (String) Workspace location region type.
74+
- `url`- (String) Workspace location region url.
6675
- `pi_workspace_name` - (String) Workspace name.
6776
- `pi_workspace_status` - (String) Workspace status, `active`, `critical`, `failed`, `provisioning`.
6877
- `pi_workspace_type` - (String) Workspace type, `off-premises` or `on-premises`.

0 commit comments

Comments
 (0)