diff --git a/ibm/service/power/resource_ibm_pi_spp_placement_group.go b/ibm/service/power/resource_ibm_pi_spp_placement_group.go index 534439feea..cbea1a8c43 100644 --- a/ibm/service/power/resource_ibm_pi_spp_placement_group.go +++ b/ibm/service/power/resource_ibm_pi_spp_placement_group.go @@ -10,8 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - st "github.com/IBM-Cloud/power-go-client/clients/instance" - "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/clients/instance" models "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" @@ -34,38 +33,38 @@ func ResourceIBMPISPPPlacementGroup() *schema.Resource { Schema: map[string]*schema.Schema{ Arg_SPPPlacementGroupName: { - Type: schema.TypeString, - Required: true, - ForceNew: true, Description: "Name of the SPP placement group", + ForceNew: true, + Required: true, + Type: schema.TypeString, }, Arg_SPPPlacementGroupPolicy: { - Type: schema.TypeString, - Required: true, + Description: "Policy of the SPP placement group", ForceNew: true, + Required: true, + Type: schema.TypeString, ValidateFunc: validate.ValidateAllowedStringValues([]string{"affinity", "anti-affinity"}), - Description: "Policy of the SPP placement group", }, - helpers.PICloudInstanceId: { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Arg_CloudInstanceID: { Description: "PI cloud instance ID", + ForceNew: true, + Required: true, + Type: schema.TypeString, }, Attr_SPPPlacementGroupMembers: { - Type: schema.TypeSet, Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, Description: "Member SPP IDs that are the SPP placement group members", + Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, }, Attr_SPPPlacementGroupID: { - Type: schema.TypeString, Computed: true, Description: "SPP placement group ID", + Type: schema.TypeString, }, }, } @@ -77,10 +76,10 @@ func resourceIBMPISPPPlacementGroupCreate(ctx context.Context, d *schema.Resourc return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) name := d.Get(Arg_SPPPlacementGroupName).(string) policy := d.Get(Arg_SPPPlacementGroupPolicy).(string) - client := st.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) body := &models.SPPPlacementGroupCreate{ Name: &name, Policy: &policy, @@ -107,7 +106,7 @@ func resourceIBMPISPPPlacementGroupRead(ctx context.Context, d *schema.ResourceD } cloudInstanceID := parts[0] - client := st.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) response, err := client.Get(parts[1]) if err != nil || response == nil { @@ -134,7 +133,7 @@ func resourceIBMPISPPPlacementGroupDelete(ctx context.Context, d *schema.Resourc return diag.FromErr(err) } cloudInstanceID := parts[0] - client := st.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) + client := instance.NewIBMPISPPPlacementGroupClient(ctx, sess, cloudInstanceID) err = client.Delete(parts[1]) if err != nil { diff --git a/ibm/service/power/resource_ibm_pi_spp_placement_group_test.go b/ibm/service/power/resource_ibm_pi_spp_placement_group_test.go index 0df6351a1a..5fb5ef7ea4 100644 --- a/ibm/service/power/resource_ibm_pi_spp_placement_group_test.go +++ b/ibm/service/power/resource_ibm_pi_spp_placement_group_test.go @@ -404,8 +404,7 @@ func testAccCheckIBMPISPPPlacementGroupConfig(name string, policy string) string pi_cloud_instance_id = "%[1]s" pi_spp_placement_group_name = "%[2]spg" pi_spp_placement_group_policy = "%[3]s" - } - `, acc.Pi_cloud_instance_id, name, policy) + }`, acc.Pi_cloud_instance_id, name, policy) } func testAccCheckIBMPISPPPlacementGroupAddMemberConfig(name string, policy string) string { @@ -422,8 +421,7 @@ func testAccCheckIBMPISPPPlacementGroupAddMemberConfig(name string, policy strin pi_cloud_instance_id = "%[1]s" pi_spp_placement_group_name = "%[2]spg" pi_spp_placement_group_policy = "%[3]s" - } - `, acc.Pi_cloud_instance_id, name, policy) + }`, acc.Pi_cloud_instance_id, name, policy) } func testAccCheckIBMPISPPPlacementGroupUpdateMemberConfig(name string, policy string) string { @@ -444,8 +442,7 @@ func testAccCheckIBMPISPPPlacementGroupUpdateMemberConfig(name string, policy st pi_cloud_instance_id = "%[1]s" pi_spp_placement_group_name = "%[2]s2pg" pi_spp_placement_group_policy = "%[3]s" - } - `, acc.Pi_cloud_instance_id, name, policy) + }`, acc.Pi_cloud_instance_id, name, policy) } func testAccCheckIBMPISPPPlacementGroupRemoveMemberConfig(name string, policy string) string { @@ -466,8 +463,7 @@ func testAccCheckIBMPISPPPlacementGroupRemoveMemberConfig(name string, policy st pi_cloud_instance_id = "%[1]s" pi_spp_placement_group_name = "%[2]s2pg" pi_spp_placement_group_policy = "%[3]s" - } - `, acc.Pi_cloud_instance_id, name, policy) + }`, acc.Pi_cloud_instance_id, name, policy) } func testAccCheckIBMPICreateSPPInPlacementGroup(name string, policy string) string { @@ -496,8 +492,7 @@ func testAccCheckIBMPICreateSPPInPlacementGroup(name string, policy string) stri pi_cloud_instance_id = "%[1]s" pi_spp_placement_group_name = "%[2]s2pg" pi_spp_placement_group_policy = "%[3]s" - } - `, acc.Pi_cloud_instance_id, name, policy) + }`, acc.Pi_cloud_instance_id, name, policy) } func testAccCheckIBMPIDeleteSPPPlacementGroup(name string, policy string) string { @@ -523,8 +518,7 @@ func testAccCheckIBMPIDeleteSPPPlacementGroup(name string, policy string) string pi_cloud_instance_id = "%[1]s" pi_spp_placement_group_name = "%[2]s2pg" pi_spp_placement_group_policy = "%[3]s" - } - `, acc.Pi_cloud_instance_id, name, policy) + }`, acc.Pi_cloud_instance_id, name, policy) } func testAccCheckIBMPICreateInstanceWithSPP(name string, policy string) string { @@ -586,8 +580,7 @@ func testAccCheckIBMPICreateInstanceWithSPP(name string, policy string) string { network_id = data.ibm_pi_network.power_networks.id } pi_shared_processor_pool = ibm_pi_shared_processor_pool.spp_pool.pi_shared_processor_pool_name - } - `, acc.Pi_cloud_instance_id, name, policy, acc.Pi_image, acc.Pi_network_name) + }`, acc.Pi_cloud_instance_id, name, policy, acc.Pi_image, acc.Pi_network_name) } func testAccCheckIBMPICreateSAPInstanceWithSPP(name string, policy string, sapProfile string) string { @@ -661,6 +654,5 @@ func testAccCheckIBMPICreateSAPInstanceWithSPP(name string, policy string, sapPr } pi_health_status = "OK" pi_shared_processor_pool = ibm_pi_shared_processor_pool.spp_pool_2.pi_shared_processor_pool_name - } - `, acc.Pi_cloud_instance_id, name, policy, acc.Pi_image, acc.Pi_network_name, acc.Pi_sap_image, sapProfile) + }`, acc.Pi_cloud_instance_id, name, policy, acc.Pi_image, acc.Pi_network_name, acc.Pi_sap_image, sapProfile) } diff --git a/website/docs/r/pi_spp_placement_group.html.markdown b/website/docs/r/pi_spp_placement_group.html.markdown index 9e18247b25..def2c27185 100644 --- a/website/docs/r/pi_spp_placement_group.html.markdown +++ b/website/docs/r/pi_spp_placement_group.html.markdown @@ -1,5 +1,4 @@ --- - subcategory: "Power Systems" layout: "ibm" page_title: "IBM: pi_spp_placement_group"