Skip to content

Commit e2b3fcf

Browse files
authored
Standardize Arg_CloudInstanceID argument across all data source and resource (#6249)
There were a couple of data sources that did not have the validation.NoZeroValues check that is required, and force new was added to the resources. The resources need force new on this argument because a user could accidentally update that field and think it does something when in reality it just messes up the state. Data sources don't need the value because data sources don't do updates.
1 parent 181ab6b commit e2b3fcf

14 files changed

+17
-14
lines changed

ibm/service/power/data_source_ibm_pi_datacenter.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ func DataSourceIBMPIDatacenter() *schema.Resource {
2222
Schema: map[string]*schema.Schema{
2323
// Arguments
2424
Arg_CloudInstanceID: {
25-
Description: "The GUID of the service instance associated with an account.",
26-
Optional: true,
27-
Type: schema.TypeString,
25+
Description: "The GUID of the service instance associated with an account.",
26+
Optional: true,
27+
Type: schema.TypeString,
28+
ValidateFunc: validation.NoZeroValues,
2829
},
2930
Arg_DatacenterZone: {
3031
Description: "Datacenter zone you want to retrieve.",

ibm/service/power/data_source_ibm_pi_datacenters.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/hashicorp/go-uuid"
1212
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1313
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
14+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1415
)
1516

1617
func DataSourceIBMPIDatacenters() *schema.Resource {
@@ -19,9 +20,10 @@ func DataSourceIBMPIDatacenters() *schema.Resource {
1920
Schema: map[string]*schema.Schema{
2021
// Arguments
2122
Arg_CloudInstanceID: {
22-
Description: "The GUID of the service instance associated with an account.",
23-
Optional: true,
24-
Type: schema.TypeString,
23+
Description: "The GUID of the service instance associated with an account.",
24+
Optional: true,
25+
Type: schema.TypeString,
26+
ValidateFunc: validation.NoZeroValues,
2527
},
2628

2729
// Attributes

ibm/service/power/data_source_ibm_pi_host.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ func DataSourceIBMPIHost() *schema.Resource {
2424
// Arguments
2525
Arg_CloudInstanceID: {
2626
Description: "The GUID of the service instance associated with an account.",
27-
ForceNew: true,
2827
Required: true,
2928
Type: schema.TypeString,
3029
ValidateFunc: validation.NoZeroValues,
3130
},
3231
Arg_HostID: {
3332
Description: "Host ID.",
34-
ForceNew: true,
3533
Required: true,
3634
Type: schema.TypeString,
3735
ValidateFunc: validation.NoZeroValues,

ibm/service/power/data_source_ibm_pi_hosts.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func DataSourceIBMPIHosts() *schema.Resource {
2525
// Arguments
2626
Arg_CloudInstanceID: {
2727
Description: "The GUID of the service instance associated with an account.",
28-
ForceNew: true,
2928
Required: true,
3029
Type: schema.TypeString,
3130
ValidateFunc: validation.NoZeroValues,

ibm/service/power/data_source_ibm_pi_network_interface.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,18 @@ func DataSourceIBMPINetworkInterface() *schema.Resource {
2525
// Arguments
2626
Arg_CloudInstanceID: {
2727
Description: "The GUID of the service instance associated with an account.",
28-
ForceNew: true,
2928
Required: true,
3029
Type: schema.TypeString,
3130
ValidateFunc: validation.NoZeroValues,
3231
},
3332
Arg_NetworkID: {
3433
Description: "Network ID.",
35-
ForceNew: true,
3634
Required: true,
3735
Type: schema.TypeString,
3836
ValidateFunc: validation.NoZeroValues,
3937
},
4038
Arg_NetworkInterfaceID: {
4139
Description: "Network interface ID.",
42-
ForceNew: true,
4340
Required: true,
4441
Type: schema.TypeString,
4542
ValidateFunc: validation.NoZeroValues,

ibm/service/power/data_source_ibm_pi_network_interfaces.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ func DataSourceIBMPINetworkInterfaces() *schema.Resource {
2525
// Arguments
2626
Arg_CloudInstanceID: {
2727
Description: "The GUID of the service instance associated with an account.",
28-
ForceNew: true,
2928
Required: true,
3029
Type: schema.TypeString,
3130
ValidateFunc: validation.NoZeroValues,
3231
},
3332
Arg_NetworkID: {
3433
Description: "Network ID.",
35-
ForceNew: true,
3634
Required: true,
3735
Type: schema.TypeString,
3836
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_instance_console_language.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func ResourceIBMPIInstanceConsoleLanguage() *schema.Resource {
3333
// Arguments
3434
Arg_CloudInstanceID: {
3535
Description: "The GUID of the service instance associated with an account.",
36+
ForceNew: true,
3637
Required: true,
3738
Type: schema.TypeString,
3839
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_instance_snapshot.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func ResourceIBMPIInstanceSnapshot() *schema.Resource {
3737
// Arguments
3838
Arg_CloudInstanceID: {
3939
Description: "The GUID of the service instance associated with an account.",
40+
ForceNew: true,
4041
Required: true,
4142
Type: schema.TypeString,
4243
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_key.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func ResourceIBMPIKey() *schema.Resource {
3434
// Arguments
3535
Arg_CloudInstanceID: {
3636
Description: "The GUID of the service instance associated with an account.",
37+
ForceNew: true,
3738
Required: true,
3839
Type: schema.TypeString,
3940
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func ResourceIBMPINetwork() *schema.Resource {
5656
},
5757
Arg_CloudInstanceID: {
5858
Description: "The GUID of the service instance associated with an account.",
59+
ForceNew: true,
5960
Required: true,
6061
Type: schema.TypeString,
6162
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_placement_group.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func ResourceIBMPIPlacementGroup() *schema.Resource {
3939
// Arguments
4040
Arg_CloudInstanceID: {
4141
Description: "The GUID of the service instance associated with an account.",
42+
ForceNew: true,
4243
Required: true,
4344
Type: schema.TypeString,
4445
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_snapshot.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func ResourceIBMPISnapshot() *schema.Resource {
4343
// Arguments
4444
Arg_CloudInstanceID: {
4545
Description: "The GUID of the service instance associated with an account.",
46+
ForceNew: true,
4647
Required: true,
4748
Type: schema.TypeString,
4849
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_volume.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func ResourceIBMPIVolume() *schema.Resource {
8383
},
8484
Arg_CloudInstanceID: {
8585
Description: "The GUID of the service instance associated with an account.",
86+
ForceNew: true,
8687
Required: true,
8788
Type: schema.TypeString,
8889
ValidateFunc: validation.NoZeroValues,

ibm/service/power/resource_ibm_pi_volume_group.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func ResourceIBMPIVolumeGroup() *schema.Resource {
3838
// Arguments
3939
Arg_CloudInstanceID: {
4040
Description: "The GUID of the service instance associated with an account.",
41+
ForceNew: true,
4142
Required: true,
4243
Type: schema.TypeString,
4344
ValidateFunc: validation.NoZeroValues,

0 commit comments

Comments
 (0)