Skip to content

Commit 1f7c945

Browse files
Diptipowervsmichaelkad
authored andcommitted
Update storage connection
1 parent f91d9c5 commit 1f7c945

11 files changed

+120
-40
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.19
44

55
require (
66
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240216115622-a311507b4b5b
7-
github.com/IBM-Cloud/power-go-client v1.6.0
7+
github.com/IBM-Cloud/power-go-client v1.6.0-beta11
88
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca
99
github.com/IBM/appconfiguration-go-admin-sdk v0.3.0
1010
github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240423071914-9e96525baef4/go.mod h1:/7h
106106
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240216115622-a311507b4b5b h1:Wnq0BuprazpP41+nQlRpxpmAs8+8jyOqU50KrvFdJQ4=
107107
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240216115622-a311507b4b5b/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
108108
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
109-
github.com/IBM-Cloud/power-go-client v1.6.0 h1:X+QX+WSF66+aouyaf4r+IeBLXUurAJj9+Bd+vH7G5I0=
110-
github.com/IBM-Cloud/power-go-client v1.6.0/go.mod h1:0ad5Lcq1utoYVJx0uqooMjCpUaYaK0ItP9QJYtY6k0Y=
109+
github.com/IBM-Cloud/power-go-client v1.6.0-beta11 h1:OVDUo72VokP+cB8Rr8pEnLBdn14SSYkoIAFVHkowkjk=
110+
github.com/IBM-Cloud/power-go-client v1.6.0-beta11/go.mod h1:bvErc8Wjz3yBlL+BHJ+ScuzuJtR+5EFasMvusluF+Yc=
111111
github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw=
112112
github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4=
113113
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs=

ibm/acctest/acctest.go

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -188,37 +188,38 @@ var (
188188
// For Power Colo
189189

190190
var (
191+
Pi_auxiliary_volume_name string
192+
Pi_cloud_instance_id string
193+
Pi_dhcp_id string
191194
Pi_image string
192-
Pi_sap_image string
193-
Pi_image_bucket_name string
194-
Pi_image_bucket_file_name string
195195
Pi_image_bucket_access_key string
196-
Pi_image_bucket_secret_key string
196+
Pi_image_bucket_file_name string
197+
Pi_image_bucket_name string
197198
Pi_image_bucket_region string
199+
Pi_image_bucket_secret_key string
200+
Pi_instance_name string
198201
Pi_key_name string
199-
Pi_volume_name string
200-
Pi_volume_id string
202+
Pi_network_name string
203+
Pi_placement_group_name string
201204
Pi_replication_volume_name string
202-
Pi_volume_onboarding_source_crn string
203-
Pi_auxiliary_volume_name string
204-
Pi_volume_group_name string
205+
Pi_resource_group_id string
206+
Pi_sap_image string
207+
Pi_shared_processor_pool_id string
208+
Pi_snapshot_id string
209+
Pi_spp_placement_group_id string
210+
Pi_storage_connection string
211+
Pi_target_storage_tier string
212+
Pi_volume_clone_task_id string
205213
Pi_volume_group_id string
214+
Pi_volume_group_name string
215+
Pi_volume_id string
216+
Pi_volume_name string
206217
Pi_volume_onboarding_id string
207-
Pi_network_name string
208-
Pi_cloud_instance_id string
209-
Pi_snapshot_id string
210-
Pi_instance_name string
211-
Pi_dhcp_id string
218+
Pi_volume_onboarding_source_crn string
212219
PiCloudConnectionName string
213220
PiSAPProfileID string
214-
Pi_placement_group_name string
215-
Pi_spp_placement_group_id string
216221
PiStoragePool string
217222
PiStorageType string
218-
Pi_shared_processor_pool_id string
219-
Pi_target_storage_tier string
220-
Pi_volume_clone_task_id string
221-
Pi_resource_group_id string
222223
)
223224

224225
var (
@@ -1136,7 +1137,10 @@ func init() {
11361137
Pi_shared_processor_pool_id = "tf-pi-shared-processor-pool"
11371138
fmt.Println("[WARN] Set the environment variable PI_SHARED_PROCESSOR_POOL_ID for testing ibm_pi_shared_processor_pool resource else it is set to default value 'tf-pi-shared-processor-pool'")
11381139
}
1139-
1140+
Pi_storage_connection = os.Getenv("PI_STORAGE_CONNECTION")
1141+
if Pi_storage_connection == "" {
1142+
fmt.Println("[WARN] Set the environment variable PI_STORAGE_CONNECTION for testing pi_storage_connection resource else it is empty")
1143+
}
11401144
Pi_target_storage_tier = os.Getenv("PI_TARGET_STORAGE_TIER")
11411145
if Pi_target_storage_tier == "" {
11421146
Pi_target_storage_tier = "terraform-test-tier"

ibm/service/power/data_source_ibm_pi_instance.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func DataSourceIBMPIInstance() *schema.Resource {
182182
Description: "The status of the instance.",
183183
Type: schema.TypeString,
184184
},
185+
Attr_StorageConnection: {
186+
Computed: true,
187+
Description: "The storage connection type.",
188+
Type: schema.TypeString,
189+
},
185190
Attr_StoragePool: {
186191
Computed: true,
187192
Description: "The storage Pool where server is deployed.",
@@ -245,6 +250,7 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m
245250
d.Set(Attr_SharedProcessorPool, powervmdata.SharedProcessorPool)
246251
d.Set(Attr_SharedProcessorPoolID, powervmdata.SharedProcessorPoolID)
247252
d.Set(Attr_Status, powervmdata.Status)
253+
d.Set(Attr_StorageConnection, powervmdata.StorageConnection)
248254
d.Set(Attr_StorageType, powervmdata.StorageType)
249255
d.Set(Attr_StoragePool, powervmdata.StoragePool)
250256
d.Set(Attr_StoragePoolAffinity, powervmdata.StoragePoolAffinity)

ibm/service/power/data_source_ibm_pi_instances.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ func DataSourceIBMPIInstances() *schema.Resource {
162162
Description: "The status of the instance.",
163163
Type: schema.TypeString,
164164
},
165+
Attr_StorageConnection: {
166+
Computed: true,
167+
Description: "The storage connection type.",
168+
Type: schema.TypeString,
169+
},
165170
Attr_StoragePool: {
166171
Computed: true,
167172
Description: "The storage Pool where server is deployed.",
@@ -235,6 +240,7 @@ func flattenPvmInstances(list []*models.PVMInstanceReference) []map[string]inter
235240
Attr_SharedProcessorPool: i.SharedProcessorPool,
236241
Attr_SharedProcessorPoolID: i.SharedProcessorPoolID,
237242
Attr_Status: *i.Status,
243+
Attr_StorageConnection: i.StorageConnection,
238244
Attr_StoragePool: i.StoragePool,
239245
Attr_StoragePoolAffinity: i.StoragePoolAffinity,
240246
Attr_StorageType: i.StorageType,

ibm/service/power/ibm_pi_constants.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const (
1717
Arg_IBMiPHA = "pi_ibmi_pha"
1818
Arg_IBMiRDSUsers = "pi_ibmi_rds_users"
1919
Arg_ImageName = "pi_image_name"
20+
Arg_ImportDetails = "pi_image_import_details"
2021
Arg_InstanceName = "pi_instance_name"
2122
Arg_KeyName = "pi_key_name"
2223
Arg_NetworkName = "pi_network_name"
@@ -153,6 +154,7 @@ const (
153154
Attr_LastUpdatedDate = "last_updated_date"
154155
Attr_Leases = "leases"
155156
Attr_LicenseRepositoryCapacity = "license_repository_capacity"
157+
Attr_LicenseType = "license_type"
156158
Attr_Location = "location"
157159
Attr_MacAddress = "macaddress"
158160
Attr_MasterChangedVolumeName = "master_changed_volume_name"
@@ -200,6 +202,7 @@ const (
200202
Attr_PrimaryRole = "primary_role"
201203
Attr_Processors = "processors"
202204
Attr_ProcType = "proctype"
205+
Attr_Product = "product"
203206
Attr_ProfileID = "profile_id"
204207
Attr_Profiles = "profiles"
205208
Attr_Progress = "progress"
@@ -255,6 +258,7 @@ const (
255258
Attr_Status = "status"
256259
Attr_StatusDescriptionErrors = "status_description_errors"
257260
Attr_StatusDetail = "status_detail"
261+
Attr_StorageConnection = "storage_connection"
258262
Attr_StoragePool = "storage_pool"
259263
Attr_StoragePoolAffinity = "storage_pool_affinity"
260264
Attr_StoragePoolsCapacity = "storage_pools_capacity"
@@ -281,6 +285,7 @@ const (
281285
Attr_UsedIPPercent = "used_ip_percent"
282286
Attr_UserIPAddress = "user_ip_address"
283287
Attr_VCPUs = "vcpus"
288+
Attr_Vendor = "vendor"
284289
Attr_VirtualCoresAssigned = "virtual_cores_assigned"
285290
Attr_VLanID = "vlan_id"
286291
Attr_VolumeGroupName = "volume_group_name"
@@ -300,8 +305,10 @@ const (
300305
Attr_WorkspaceStatus = "pi_workspace_status"
301306
Attr_WorkspaceType = "pi_workspace_type"
302307
Attr_WWN = "wwn"
303-
OS_IBMI = "ibmi"
304308

309+
MaxVolumeSupport = "maxVolumeSupport"
310+
OS_IBMI = "ibmi"
311+
// Allowed Values
305312
// TODO: Second Half Cleanup, remove extra variables
306313

307314
// SAP Profile

ibm/service/power/resource_ibm_pi_instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func ResourceIBMPIInstance() *schema.Resource {
138138
helpers.PIInstanceStorageConnection: {
139139
Type: schema.TypeString,
140140
Optional: true,
141-
ValidateFunc: validate.ValidateAllowedStringValues([]string{"vSCSI"}),
141+
ValidateFunc: validate.ValidateAllowedStringValues([]string{vSCSI, MaxVolumeSupport}),
142142
Description: "Storage Connectivity Group for server deployment",
143143
},
144144
PIInstanceStoragePoolAffinity: {

ibm/service/power/resource_ibm_pi_instance_test.go

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,31 @@ func testAccCheckIBMPIInstanceReplicantConfig(name string) string {
224224
}
225225
`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, acc.Pi_volume_name)
226226
}
227-
227+
func testAccCheckIBMPIInstanceStorageConnectionConfig(name, instanceHealthStatus string) string {
228+
return fmt.Sprintf(`
229+
resource "ibm_pi_volume" "power_volume" {
230+
pi_cloud_instance_id = "%[1]s"
231+
pi_volume_size = 1
232+
pi_volume_name = "%[2]s"
233+
pi_volume_type = "tier3"
234+
}
235+
resource "ibm_pi_instance" "power_instance" {
236+
pi_cloud_instance_id = "%[1]s"
237+
pi_memory = "2"
238+
pi_processors = "1"
239+
pi_instance_name = "%[2]s"
240+
pi_proc_type = "shared"
241+
pi_image_id = "%[3]s"
242+
pi_sys_type = "s922"
243+
pi_network {
244+
network_id = "%[4]s"
245+
}
246+
pi_storage_connection = "%[5]s"
247+
pi_health_status = "%[6]s"
248+
pi_volume_ids = [ibm_pi_volume.power_volume.volume_id]
249+
}
250+
`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, acc.Pi_storage_connection, instanceHealthStatus)
251+
}
228252
func testAccCheckIBMPIInstanceDestroy(s *terraform.State) error {
229253
sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession()
230254
if err != nil {
@@ -305,7 +329,25 @@ func TestAccIBMPIInstanceBasic(t *testing.T) {
305329
},
306330
})
307331
}
308-
332+
func TestAccIBMPIInstanceStorageConnection(t *testing.T) {
333+
instanceRes := "ibm_pi_instance.power_instance"
334+
name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100))
335+
resource.Test(t, resource.TestCase{
336+
PreCheck: func() { acc.TestAccPreCheck(t) },
337+
Providers: acc.TestAccProviders,
338+
CheckDestroy: testAccCheckIBMPIInstanceDestroy,
339+
Steps: []resource.TestStep{
340+
{
341+
Config: testAccCheckIBMPIInstanceStorageConnectionConfig(name, helpers.PIInstanceHealthOk),
342+
Check: resource.ComposeTestCheckFunc(
343+
testAccCheckIBMPIInstanceExists(instanceRes),
344+
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name),
345+
resource.TestCheckResourceAttr(instanceRes, "pi_storage_connection", acc.Pi_storage_connection),
346+
),
347+
},
348+
},
349+
})
350+
}
309351
func TestAccIBMPIInstanceDeploymentType(t *testing.T) {
310352
instanceRes := "ibm_pi_instance.power_instance"
311353
name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100))

website/docs/d/pi_instance.html.markdown

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,27 @@ description: |-
77
---
88

99
# ibm_pi_instance
10+
1011
Retrieve information about a Power Systems Virtual Server instance. For more information, about Power Virtual Server instance, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started).
1112

1213
## Example usage
14+
1315
```terraform
1416
data "ibm_pi_instance" "ds_instance" {
1517
pi_instance_name = "terraform-test-instance"
1618
pi_cloud_instance_id = "49fba6c9-23f8-40bc-9899-aca322ee7d5b"
1719
}
1820
```
1921

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

2629
Example usage:
30+
2731
```terraform
2832
provider "ibm" {
2933
region = "lon"
@@ -32,18 +36,21 @@ Example usage:
3236
```
3337

3438
## Argument reference
39+
3540
Review the argument references that you can specify for your data source.
3641

3742
- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account.
3843
- `pi_instance_name` - (Required, String) The unique identifier or name of the instance.
3944

4045
## Attribute reference
46+
4147
In addition to all argument reference list, you can access the following attribute references after your data source is created.
4248

4349
- `deployment_type` - (String) The custom deployment type.
4450
- `health_status` - (String) The health of the instance.
4551

4652
**Notes** IBM i software licenses for IBM i virtual server instances -- only for IBM i instances
53+
4754
- `ibmi_css` - (Boolean) IBM i Cloud Storage Solution.
4855
- `ibmi_pha` - (Boolean) IBM i Power High Availability.
4956
- `ibmi_rds` - (Boolean) IBM i Rational Dev Studio.
@@ -75,6 +82,7 @@ In addition to all argument reference list, you can access the following attribu
7582
- `shared_processor_pool`- (String) The name of the shared processor pool for the instance.
7683
- `shared_processor_pool_id` - (String) The ID of the shared processor pool for the instance.
7784
- `status` - (String) The status of the instance.
85+
- `storage_connection` - (String) The storage connection type for the instance.
7886
- `storage_pool` - (String) The storage Pool where server is deployed.
7987
- `storage_pool_affinity` - (Boolean) Indicates if all volumes attached to the server must reside in the same storage pool.
8088
- `storage_type` - (String) The storage type where server is deployed.

website/docs/d/pi_instances.html.markdown

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

99
# ibm_pi_instances
10+
1011
Retrieve information about all Power Systems Virtual Server instances for the given cloud instance. For more information, about Power Virtual Server instances, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started).
1112

1213
## Example usage
14+
1315
```terraform
1416
data "ibm_pi_instances" "ds_instance" {
1517
pi_cloud_instance_id = "49fba6c9-23f8-40bc-9899-aca322ee7d5b"
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,20 +35,22 @@ Example usage:
3135
```
3236

3337
## Argument reference
34-
Review the argument references that you can specify for your data source.
38+
39+
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
39-
In addition to all argument reference list, you can access the following attribute references after your data source is created.
44+
45+
In addition to all argument reference list, you can access the following attribute references after your data source is created.
4046

4147
- `pvm_instances` - (List) List of power virtual server instances for the respective cloud instance.
4248

4349
Nested scheme for `pvm_instances`:
4450
- `health_status` - (String) The health of the instance.
4551
- `license_repository_capacity` - (Deprecated, Integer) The VTL license repository capacity TB value. Only available with VTL instances.
4652
- `memory` - (Float) The amount of memory that is allocated to the instance.
47-
- `minproc`- (Float) The minimum number of processors that must be allocated to the instance.
53+
- `minproc`- (Float) The minimum number of processors that must be allocated to the instance.
4854
- `maxproc`- (Float) The maximum number of processors that can be allocated to the instance without shutting down or rebooting the `LPAR`.
4955
- `max_virtual_cores` - (Integer) The maximum number of virtual cores that can be assigned without rebooting the instance.
5056
- `minmem`- (Float) The minimum amount of memory that must be allocated to the instance.
@@ -53,12 +59,12 @@ In addition to all argument reference list, you can access the following attribu
5359
- `networks` - (List) List of networks associated with this instance.
5460

5561
Nested scheme for `networks`:
56-
- `external_ip` - (String) The external IP address of the instance.
57-
- `ip` - (String) The IP address of the instance.
58-
- `macaddress` - (String) The MAC address of the instance.
59-
- `network_id` - (String) The network ID of the instance.
60-
- `network_name` - (String) The network name of the instance.
61-
- `type` - (String) The type of the network.
62+
- `external_ip` - (String) The external IP address of the instance.
63+
- `ip` - (String) The IP address of the instance.
64+
- `macaddress` - (String) The MAC address of the instance.
65+
- `network_id` - (String) The network ID of the instance.
66+
- `network_name` - (String) The network name of the instance.
67+
- `type` - (String) The type of the network.
6268

6369
- `pin_policy` - (String) The pinning policy of the instance.
6470
- `placement_group_id`- (String) The ID of the placement group that the instance is a member.
@@ -69,6 +75,7 @@ In addition to all argument reference list, you can access the following attribu
6975
- `shared_processor_pool`- (String) The name of the shared processor pool for the instance.
7076
- `shared_processor_pool_id` - (String) The ID of the shared processor pool for the instance.
7177
- `status` - (String) The status of the instance.
78+
- `storage_connection` - (String) The storage connection type for the instance
7279
- `storage_pool` - (String) The storage Pool where server is deployed.
7380
- `storage_pool_affinity` - (Boolean) Indicates if all volumes attached to the server must reside in the same storage pool.
7481
- `storage_type` - (String) The storage type where server is deployed.

0 commit comments

Comments
 (0)