From 0041d133991bc1456fe4dff8e9bea7ceb972e6a8 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Mon, 11 Dec 2023 16:22:07 -0600 Subject: [PATCH 1/9] Refactor deprecated fields and messages Deprecated fields and messages are wildly inconsistent. Several deprecated fields are not marked as such and the documention is not laid out consistently. This commit should bring them all in line. --- ibm/service/power/data_source_ibm_pi_dhcp.go | 3 ++- ibm/service/power/data_source_ibm_pi_dhcps.go | 3 ++- ibm/service/power/data_source_ibm_pi_network.go | 2 +- ibm/service/power/resource_ibm_pi_dhcp.go | 3 ++- ibm/service/power/resource_ibm_pi_instance.go | 7 +------ ibm/service/power/resource_ibm_pi_key.go | 7 ++++--- ibm/service/power/resource_ibm_pi_network_port_attach.go | 2 +- website/docs/d/pi_dhcp.html.markdown | 2 +- website/docs/d/pi_dhcps.html.markdown | 2 +- website/docs/r/pi_dhcp.html.markdown | 2 +- website/docs/r/pi_instance.html.markdown | 2 +- website/docs/r/pi_key.html.markdown | 2 +- website/docs/r/pi_network_port_attach.html.markdown | 2 +- 13 files changed, 19 insertions(+), 20 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_dhcp.go b/ibm/service/power/data_source_ibm_pi_dhcp.go index c6e716c020b..a835239329f 100644 --- a/ibm/service/power/data_source_ibm_pi_dhcp.go +++ b/ibm/service/power/data_source_ibm_pi_dhcp.go @@ -63,7 +63,8 @@ func DataSourceIBMPIDhcp() *schema.Resource { Attr_DhcpNetworkDeprecated: { Type: schema.TypeString, Computed: true, - Description: "The ID of the DHCP Server private network (deprecated - replaced by network_id)", + Description: "The ID of the DHCP Server private network", + Deprecated: "This field is deprecated, use network_id instead", }, Attr_DhcpNetworkID: { Type: schema.TypeString, diff --git a/ibm/service/power/data_source_ibm_pi_dhcps.go b/ibm/service/power/data_source_ibm_pi_dhcps.go index a95f1935b55..2940f6da0a5 100644 --- a/ibm/service/power/data_source_ibm_pi_dhcps.go +++ b/ibm/service/power/data_source_ibm_pi_dhcps.go @@ -48,7 +48,8 @@ func DataSourceIBMPIDhcps() *schema.Resource { Attr_DhcpNetworkDeprecated: { Type: schema.TypeString, Computed: true, - Description: "The ID of the DHCP Server private network (deprecated - replaced by network_id)", + Description: "The ID of the DHCP Server private network", + Deprecated: "This field is deprecated, use network_id instead", }, Attr_DhcpNetworkID: { Type: schema.TypeString, diff --git a/ibm/service/power/data_source_ibm_pi_network.go b/ibm/service/power/data_source_ibm_pi_network.go index a080f5a0221..6736be6bb70 100644 --- a/ibm/service/power/data_source_ibm_pi_network.go +++ b/ibm/service/power/data_source_ibm_pi_network.go @@ -68,7 +68,7 @@ func DataSourceIBMPINetwork() *schema.Resource { "name": { Type: schema.TypeString, Computed: true, - Deprecated: "This value is deprecated in favor of" + helpers.PINetworkName, + Deprecated: "This field is deprecated, use pi_network_name instead", }, "dns": { Type: schema.TypeSet, diff --git a/ibm/service/power/resource_ibm_pi_dhcp.go b/ibm/service/power/resource_ibm_pi_dhcp.go index c4d1d96532c..38314f82bc8 100644 --- a/ibm/service/power/resource_ibm_pi_dhcp.go +++ b/ibm/service/power/resource_ibm_pi_dhcp.go @@ -101,7 +101,8 @@ func ResourceIBMPIDhcp() *schema.Resource { Attr_DhcpNetworkDeprecated: { Type: schema.TypeString, Computed: true, - Description: "The ID of the DHCP Server private network (deprecated - replaced by network_id)", + Description: "The ID of the DHCP Server private network", + Deprecated: "This field is deprecated, use network_id instead", }, Attr_DhcpNetworkID: { Type: schema.TypeString, diff --git a/ibm/service/power/resource_ibm_pi_instance.go b/ibm/service/power/resource_ibm_pi_instance.go index 0a5a760803a..63dda4b69be 100644 --- a/ibm/service/power/resource_ibm_pi_instance.go +++ b/ibm/service/power/resource_ibm_pi_instance.go @@ -61,6 +61,7 @@ func ResourceIBMPIInstance() *schema.Resource { Optional: true, Computed: true, Description: "set to true to enable migration of the PI instance", + Deprecated: "This field is deprecated, use pin_policy instead", }, "min_processors": { Type: schema.TypeFloat, @@ -313,12 +314,6 @@ func ResourceIBMPIInstance() *schema.Resource { Default: "none", ValidateFunc: validate.ValidateAllowedStringValues([]string{"none", "soft", "hard"}), }, - - // "reboot_for_resource_change": { - // Type: schema.TypeString, - // Optional: true, - // Description: "Flag to be passed for CPU/Memory changes that require a reboot to take effect", - // }, "operating_system": { Type: schema.TypeString, Computed: true, diff --git a/ibm/service/power/resource_ibm_pi_key.go b/ibm/service/power/resource_ibm_pi_key.go index 3f305e4da2b..e91b12fcbf2 100644 --- a/ibm/service/power/resource_ibm_pi_key.go +++ b/ibm/service/power/resource_ibm_pi_key.go @@ -56,9 +56,10 @@ func ResourceIBMPIKey() *schema.Resource { Description: "Date of SSH Key creation", }, Attr_KeyID: { - Type: schema.TypeString, - Computed: true, - Deprecated: "User defined name for the SSH key (deprecated - replaced by name)", + Type: schema.TypeString, + Computed: true, + Description: "User defined name for the SSH key", + Deprecated: "This field is deprecated, use pi_key_name instead", }, Attr_KeyName: { Type: schema.TypeString, diff --git a/ibm/service/power/resource_ibm_pi_network_port_attach.go b/ibm/service/power/resource_ibm_pi_network_port_attach.go index b6dd3057639..243bc87cb2f 100644 --- a/ibm/service/power/resource_ibm_pi_network_port_attach.go +++ b/ibm/service/power/resource_ibm_pi_network_port_attach.go @@ -72,7 +72,7 @@ func ResourceIBMPINetworkPortAttach() *schema.Resource { "port_id": { Type: schema.TypeString, Computed: true, - Deprecated: "port_id attribute is deprecated, use network_port_id instead.", + Deprecated: "This field is deprecated, use network_port_id instead", }, "network_port_id": { Type: schema.TypeString, diff --git a/website/docs/d/pi_dhcp.html.markdown b/website/docs/d/pi_dhcp.html.markdown index cf6f1221d5d..b784cf90e7e 100644 --- a/website/docs/d/pi_dhcp.html.markdown +++ b/website/docs/d/pi_dhcp.html.markdown @@ -34,7 +34,7 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `leases`: - `instance_ip` - (String) The IP of the PVM Instance. - `instance_mac` - (String) The MAC Address of the PVM Instance. -- `network` - (String) The ID of the DHCP Server private network (deprecated - replaced by `network_id`). +- `network` - (Deprecated, String) The ID of the DHCP Server private network. - `network_id`- (String) The ID of the DHCP Server private network. - `network_name` - The name of the DHCP Server private network. - `status` - (String) The status of the DHCP Server. diff --git a/website/docs/d/pi_dhcps.html.markdown b/website/docs/d/pi_dhcps.html.markdown index edc89f2dd5e..1172c26fe26 100644 --- a/website/docs/d/pi_dhcps.html.markdown +++ b/website/docs/d/pi_dhcps.html.markdown @@ -33,7 +33,7 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `servers`: - `dhcp_id` - (String) The ID of the DHCP Server. - - `network` - (String) The ID of the DHCP Server private network (deprecated - replaced by `network_id`). + - `network` - (Deprecated, String) The ID of the DHCP Server private network. - `network_id`- (String) The ID of the DHCP Server private network. - `network_name` - The name of the DHCP Server private network. - `status` - (String) The status of the DHCP Server. diff --git a/website/docs/r/pi_dhcp.html.markdown b/website/docs/r/pi_dhcp.html.markdown index b39b0b9c836..da1c9c5b893 100644 --- a/website/docs/r/pi_dhcp.html.markdown +++ b/website/docs/r/pi_dhcp.html.markdown @@ -40,7 +40,7 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `leases`: - `instance_ip` - (String) The IP of the PVM Instance. - `instance_mac` - (String) The MAC Address of the PVM Instance. -- `network` - (String) The ID of the DHCP Server private network (deprecated - replaced by `network_id`). +- `network` - (Deprecated, String) The ID of the DHCP Server private network. - `network_id`- (String) The ID of the DHCP Server private network. - `network_name` - The name of the DHCP Server private network. - `status` - (String) The status of the DHCP Server. diff --git a/website/docs/r/pi_instance.html.markdown b/website/docs/r/pi_instance.html.markdown index 6a5e2234a98..fe55f397fb0 100644 --- a/website/docs/r/pi_instance.html.markdown +++ b/website/docs/r/pi_instance.html.markdown @@ -74,7 +74,7 @@ Review the argument references that you can specify for your resource. - **Note**: Provisioning VTL instances is temporarily disabled. - `pi_memory` - (Optional, Float) The amount of memory that you want to assign to your instance in gigabytes. - Required when not creating SAP instances. Conflicts with `pi_sap_profile_id`. -- `pi_migratable`- (Optional, Bool) Indicates the VM is migrated or not. +- `pi_migratable`- (Deprecated, Optional, Bool) Indicates the VM is migrated or not. - `pi_network` - (Required, List of Map) List of one or more networks to attach to the instance. The `pi_network` block supports: diff --git a/website/docs/r/pi_key.html.markdown b/website/docs/r/pi_key.html.markdown index d43ef988ccc..18f06ef14ee 100644 --- a/website/docs/r/pi_key.html.markdown +++ b/website/docs/r/pi_key.html.markdown @@ -32,7 +32,7 @@ Review the argument references that you can specify for your resource. In addition to all argument reference list, you can access the following attribute reference after your resource is created. - `id` - (String) The unique identifier of the key. The ID is composed of `/`. -- `key_id` - (String) User defined name for the SSH key (deprecated - replaced by `name`). +- `key_id` - (Deprecated, String) User defined name for the SSH key. - `name` - (String) User defined name for the SSH key - `creation_date` - (String) Date of SSH Key creation. - `ssh_key` - (String) SSH RSA key. diff --git a/website/docs/r/pi_network_port_attach.html.markdown b/website/docs/r/pi_network_port_attach.html.markdown index de0c14dfa59..ff2c3857911 100644 --- a/website/docs/r/pi_network_port_attach.html.markdown +++ b/website/docs/r/pi_network_port_attach.html.markdown @@ -61,7 +61,7 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier of the instance. The ID is composed of `//`. - `macaddress` - (String) The MAC address of the port. - `network_port_id` - (String) The ID of the port. -- `portid` - (Deprecated, String) The ID of the port. +- `port_id` - (Deprecated, String) The ID of the port. - `public_ip` - (String) The public IP associated with the port. - `status` - (String) The status of the port. From f23accada0f7ce08c087de048d467eca3d408fe1 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 4 Jan 2024 10:50:34 -0600 Subject: [PATCH 2/9] Remove deprecated fields from dhcp(s) data source and resource --- ibm/service/power/data_source_ibm_pi_dhcp.go | 7 ------- ibm/service/power/data_source_ibm_pi_dhcps.go | 7 ------- ibm/service/power/resource_ibm_pi_dhcp.go | 7 ------- website/docs/d/pi_dhcp.html.markdown | 1 - website/docs/d/pi_dhcps.html.markdown | 1 - website/docs/r/pi_dhcp.html.markdown | 1 - 6 files changed, 24 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_dhcp.go b/ibm/service/power/data_source_ibm_pi_dhcp.go index a835239329f..b42bbc98dcd 100644 --- a/ibm/service/power/data_source_ibm_pi_dhcp.go +++ b/ibm/service/power/data_source_ibm_pi_dhcp.go @@ -60,12 +60,6 @@ func DataSourceIBMPIDhcp() *schema.Resource { }, }, }, - Attr_DhcpNetworkDeprecated: { - Type: schema.TypeString, - Computed: true, - Description: "The ID of the DHCP Server private network", - Deprecated: "This field is deprecated, use network_id instead", - }, Attr_DhcpNetworkID: { Type: schema.TypeString, Computed: true, @@ -115,7 +109,6 @@ func dataSourceIBMPIDhcpRead(ctx context.Context, d *schema.ResourceData, meta i if dhcpServer.Network != nil { dhcpNetwork := dhcpServer.Network if dhcpNetwork.ID != nil { - d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID) d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID) } if dhcpNetwork.Name != nil { diff --git a/ibm/service/power/data_source_ibm_pi_dhcps.go b/ibm/service/power/data_source_ibm_pi_dhcps.go index 2940f6da0a5..79c2586daec 100644 --- a/ibm/service/power/data_source_ibm_pi_dhcps.go +++ b/ibm/service/power/data_source_ibm_pi_dhcps.go @@ -45,12 +45,6 @@ func DataSourceIBMPIDhcps() *schema.Resource { Computed: true, Description: "The ID of the DHCP Server", }, - Attr_DhcpNetworkDeprecated: { - Type: schema.TypeString, - Computed: true, - Description: "The ID of the DHCP Server private network", - Deprecated: "This field is deprecated, use network_id instead", - }, Attr_DhcpNetworkID: { Type: schema.TypeString, Computed: true, @@ -104,7 +98,6 @@ func dataSourceIBMPIDhcpServersRead(ctx context.Context, d *schema.ResourceData, if dhcpServer.Network != nil { dhcpNetwork := dhcpServer.Network if dhcpNetwork.ID != nil { - d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID) d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID) } if dhcpNetwork.Name != nil { diff --git a/ibm/service/power/resource_ibm_pi_dhcp.go b/ibm/service/power/resource_ibm_pi_dhcp.go index 38314f82bc8..071b3d80ad3 100644 --- a/ibm/service/power/resource_ibm_pi_dhcp.go +++ b/ibm/service/power/resource_ibm_pi_dhcp.go @@ -98,12 +98,6 @@ func ResourceIBMPIDhcp() *schema.Resource { }, }, }, - Attr_DhcpNetworkDeprecated: { - Type: schema.TypeString, - Computed: true, - Description: "The ID of the DHCP Server private network", - Deprecated: "This field is deprecated, use network_id instead", - }, Attr_DhcpNetworkID: { Type: schema.TypeString, Computed: true, @@ -211,7 +205,6 @@ func resourceIBMPIDhcpRead(ctx context.Context, d *schema.ResourceData, meta int if dhcpServer.Network != nil { dhcpNetwork := dhcpServer.Network if dhcpNetwork.ID != nil { - d.Set(Attr_DhcpNetworkDeprecated, *dhcpNetwork.ID) d.Set(Attr_DhcpNetworkID, *dhcpNetwork.ID) } if dhcpNetwork.Name != nil { diff --git a/website/docs/d/pi_dhcp.html.markdown b/website/docs/d/pi_dhcp.html.markdown index b784cf90e7e..74a73de0982 100644 --- a/website/docs/d/pi_dhcp.html.markdown +++ b/website/docs/d/pi_dhcp.html.markdown @@ -34,7 +34,6 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `leases`: - `instance_ip` - (String) The IP of the PVM Instance. - `instance_mac` - (String) The MAC Address of the PVM Instance. -- `network` - (Deprecated, String) The ID of the DHCP Server private network. - `network_id`- (String) The ID of the DHCP Server private network. - `network_name` - The name of the DHCP Server private network. - `status` - (String) The status of the DHCP Server. diff --git a/website/docs/d/pi_dhcps.html.markdown b/website/docs/d/pi_dhcps.html.markdown index 1172c26fe26..1f0095f1d76 100644 --- a/website/docs/d/pi_dhcps.html.markdown +++ b/website/docs/d/pi_dhcps.html.markdown @@ -33,7 +33,6 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `servers`: - `dhcp_id` - (String) The ID of the DHCP Server. - - `network` - (Deprecated, String) The ID of the DHCP Server private network. - `network_id`- (String) The ID of the DHCP Server private network. - `network_name` - The name of the DHCP Server private network. - `status` - (String) The status of the DHCP Server. diff --git a/website/docs/r/pi_dhcp.html.markdown b/website/docs/r/pi_dhcp.html.markdown index da1c9c5b893..4681c2d2891 100644 --- a/website/docs/r/pi_dhcp.html.markdown +++ b/website/docs/r/pi_dhcp.html.markdown @@ -40,7 +40,6 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `leases`: - `instance_ip` - (String) The IP of the PVM Instance. - `instance_mac` - (String) The MAC Address of the PVM Instance. -- `network` - (Deprecated, String) The ID of the DHCP Server private network. - `network_id`- (String) The ID of the DHCP Server private network. - `network_name` - The name of the DHCP Server private network. - `status` - (String) The status of the DHCP Server. From 891f5d38b3d9c10bb42e55ab95e2ee9b07853393 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 4 Jan 2024 10:51:18 -0600 Subject: [PATCH 3/9] Remove deprecated fields for instance data source and resource --- .../power/data_source_ibm_pi_instance.go | 48 ------------------- ibm/service/power/resource_ibm_pi_instance.go | 24 +--------- website/docs/d/pi_instance.html.markdown | 9 ---- website/docs/r/pi_instance.html.markdown | 1 - 4 files changed, 1 insertion(+), 81 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_instance.go b/ibm/service/power/data_source_ibm_pi_instance.go index 354cfe951bd..31317b561f2 100644 --- a/ibm/service/power/data_source_ibm_pi_instance.go +++ b/ibm/service/power/data_source_ibm_pi_instance.go @@ -52,39 +52,6 @@ func DataSourceIBMPIInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "addresses": { - Type: schema.TypeList, - Computed: true, - Deprecated: "This field is deprecated, use networks instead", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ip": { - Type: schema.TypeString, - Computed: true, - }, - "macaddress": { - Type: schema.TypeString, - Computed: true, - }, - "network_id": { - Type: schema.TypeString, - Computed: true, - }, - "network_name": { - Type: schema.TypeString, - Computed: true, - }, - "type": { - Type: schema.TypeString, - Computed: true, - }, - "external_ip": { - Type: schema.TypeString, - Computed: true, - }, - }, - }, - }, "networks": { Type: schema.TypeList, Computed: true, @@ -243,21 +210,6 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m d.Set(Attr_PIInstanceSharedProcessorPool, powervmdata.SharedProcessorPool) d.Set(Attr_PIInstanceSharedProcessorPoolID, powervmdata.SharedProcessorPoolID) - if powervmdata.Addresses != nil { - pvmaddress := make([]map[string]interface{}, len(powervmdata.Addresses)) - for i, pvmip := range powervmdata.Addresses { - p := make(map[string]interface{}) - p["ip"] = pvmip.IPAddress - p["network_name"] = pvmip.NetworkName - p["network_id"] = pvmip.NetworkID - p["macaddress"] = pvmip.MacAddress - p["type"] = pvmip.Type - p["external_ip"] = pvmip.ExternalIP - pvmaddress[i] = p - } - d.Set("addresses", pvmaddress) - } - if powervmdata.Health != nil { d.Set("health_status", powervmdata.Health.Status) } diff --git a/ibm/service/power/resource_ibm_pi_instance.go b/ibm/service/power/resource_ibm_pi_instance.go index 6cec2abe7b6..a0a79f196ca 100644 --- a/ibm/service/power/resource_ibm_pi_instance.go +++ b/ibm/service/power/resource_ibm_pi_instance.go @@ -56,13 +56,6 @@ func ResourceIBMPIInstance() *schema.Resource { Computed: true, Description: "PI instance status", }, - "pi_migratable": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Description: "set to true to enable migration of the PI instance", - Deprecated: "This field is deprecated, use pin_policy instead", - }, "min_processors": { Type: schema.TypeFloat, Computed: true, @@ -430,9 +423,6 @@ func resourceIBMPIInstanceRead(ctx context.Context, d *schema.ResourceData, meta d.Set("status", powervmdata.Status) } d.Set(helpers.PIInstanceProcType, powervmdata.ProcType) - if powervmdata.Migratable != nil { - d.Set("pi_migratable", powervmdata.Migratable) - } d.Set("min_processors", powervmdata.Minproc) d.Set(helpers.PIInstanceProgress, powervmdata.Progress) if powervmdata.StorageType != nil { @@ -593,7 +583,7 @@ func resourceIBMPIInstanceUpdate(ctx context.Context, d *schema.ResourceData, me } // Start of the change for Memory and Processors - if d.HasChange(helpers.PIInstanceMemory) || d.HasChange(helpers.PIInstanceProcessors) || d.HasChange("pi_migratable") { + if d.HasChange(helpers.PIInstanceMemory) || d.HasChange(helpers.PIInstanceProcessors) { maxMemLpar := d.Get("max_memory").(float64) maxCPULpar := d.Get("max_processors").(float64) @@ -622,10 +612,6 @@ func resourceIBMPIInstanceUpdate(ctx context.Context, d *schema.ResourceData, me Memory: mem, Processors: procs, } - if m, ok := d.GetOk("pi_migratable"); ok { - migratable := m.(bool) - body.Migratable = &migratable - } if cores_enabled { log.Printf("support for %s is enabled", CUSTOM_VIRTUAL_CORES) body.VirtualCores = &models.VirtualCores{Assigned: &assignedVirtualCores} @@ -1179,11 +1165,6 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i if r, ok := d.GetOk(helpers.PIInstanceReplicationScheme); ok { replicationNamingScheme = r.(string) } - var migratable bool - if m, ok := d.GetOk("pi_migratable"); ok { - migratable = m.(bool) - } - var pinpolicy string if p, ok := d.GetOk(helpers.PIInstancePinPolicy); ok { pinpolicy = p.(string) @@ -1197,9 +1178,7 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i userData = u.(string) } - //publicinterface := d.Get(helpers.PIInstancePublicNetwork).(bool) body := &models.PVMInstanceCreate{ - //NetworkIds: networks, Processors: &procs, Memory: &mem, ServerName: flex.PtrToString(name), @@ -1211,7 +1190,6 @@ func createPVMInstance(d *schema.ResourceData, client *st.IBMPIInstanceClient, i ReplicantNamingScheme: flex.PtrToString(replicationNamingScheme), ReplicantAffinityPolicy: flex.PtrToString(replicationpolicy), Networks: pvmNetworks, - Migratable: &migratable, } if s, ok := d.GetOk(helpers.PIInstanceSSHKeyName); ok { sshkey := s.(string) diff --git a/website/docs/d/pi_instance.html.markdown b/website/docs/d/pi_instance.html.markdown index 75fecd8d534..bfef1793469 100644 --- a/website/docs/d/pi_instance.html.markdown +++ b/website/docs/d/pi_instance.html.markdown @@ -44,15 +44,6 @@ Review the argument references that you can specify for your data source. ## Attribute reference In addition to all argument reference list, you can access the following attribute references after your data source is created. -- `addresses` - (Deprecated, List of objects) - The address associated with this instance. - - Nested scheme for `addresses`: - - `ip` - (String) The IP address of the instance. - - `external_ip` - (String) The external IP address of the instance. - - `macaddress` - (String) The MAC address of the instance. - - `network_id` - (String) The network ID of the instance. - - `network_name` - (String) The network name of the instance. - - `type` - (String) The type of the network. - `deployment_type` - (String) The custom deployment type. - `health_status` - (String) The health of the instance. - `id` - (String) The unique identifier of the instance. diff --git a/website/docs/r/pi_instance.html.markdown b/website/docs/r/pi_instance.html.markdown index 1a50315a626..8bd2f88010a 100644 --- a/website/docs/r/pi_instance.html.markdown +++ b/website/docs/r/pi_instance.html.markdown @@ -74,7 +74,6 @@ Review the argument references that you can specify for your resource. - **Note**: Provisioning VTL instances is temporarily disabled. - `pi_memory` - (Optional, Float) The amount of memory that you want to assign to your instance in gigabytes. - Required when not creating SAP instances. Conflicts with `pi_sap_profile_id`. -- `pi_migratable`- (Deprecated, Optional, Bool) Indicates the VM is migrated or not. - `pi_network` - (Required, List of Map) List of one or more networks to attach to the instance. The `pi_network` block supports: From 2226905c18df5ab3f91ca2707a5d13d7520218f1 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 4 Jan 2024 11:03:00 -0600 Subject: [PATCH 4/9] Remove deprecated fields for key data source and resource --- ibm/service/power/data_source_ibm_pi_key.go | 7 ------- ibm/service/power/resource_ibm_pi_key.go | 7 ------- website/docs/r/pi_key.html.markdown | 1 - 3 files changed, 15 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_key.go b/ibm/service/power/data_source_ibm_pi_key.go index 70ab96ba7c7..911154b6d86 100644 --- a/ibm/service/power/data_source_ibm_pi_key.go +++ b/ibm/service/power/data_source_ibm_pi_key.go @@ -46,12 +46,6 @@ func DataSourceIBMPIKey() *schema.Resource { Computed: true, Description: "SSH RSA key", }, - "sshkey": { - Type: schema.TypeString, - Sensitive: true, - Computed: true, - Deprecated: "This field is deprecated, use ssh_key instead", - }, }, } } @@ -78,7 +72,6 @@ func dataSourceIBMPIKeyRead(ctx context.Context, d *schema.ResourceData, meta in d.SetId(*sshkeydata.Name) d.Set(Attr_KeyCreationDate, sshkeydata.CreationDate.String()) d.Set(Attr_Key, sshkeydata.SSHKey) - d.Set("sshkey", sshkeydata.SSHKey) // TODO: deprecated, to remove return nil } diff --git a/ibm/service/power/resource_ibm_pi_key.go b/ibm/service/power/resource_ibm_pi_key.go index e91b12fcbf2..10ee1efcc41 100644 --- a/ibm/service/power/resource_ibm_pi_key.go +++ b/ibm/service/power/resource_ibm_pi_key.go @@ -55,12 +55,6 @@ func ResourceIBMPIKey() *schema.Resource { Computed: true, Description: "Date of SSH Key creation", }, - Attr_KeyID: { - Type: schema.TypeString, - Computed: true, - Description: "User defined name for the SSH key", - Deprecated: "This field is deprecated, use pi_key_name instead", - }, Attr_KeyName: { Type: schema.TypeString, Computed: true, @@ -128,7 +122,6 @@ func resourceIBMPIKeyRead(ctx context.Context, d *schema.ResourceData, meta inte // set attributes d.Set(Attr_KeyName, sshkeydata.Name) - d.Set(Attr_KeyID, sshkeydata.Name) d.Set(Attr_Key, sshkeydata.SSHKey) d.Set(Attr_KeyCreationDate, sshkeydata.CreationDate.String()) diff --git a/website/docs/r/pi_key.html.markdown b/website/docs/r/pi_key.html.markdown index 18f06ef14ee..49ac7103530 100644 --- a/website/docs/r/pi_key.html.markdown +++ b/website/docs/r/pi_key.html.markdown @@ -32,7 +32,6 @@ Review the argument references that you can specify for your resource. In addition to all argument reference list, you can access the following attribute reference after your resource is created. - `id` - (String) The unique identifier of the key. The ID is composed of `/`. -- `key_id` - (Deprecated, String) User defined name for the SSH key. - `name` - (String) User defined name for the SSH key - `creation_date` - (String) Date of SSH Key creation. - `ssh_key` - (String) SSH RSA key. From df1e4e802180f6e31efe2c763c323036f71dbb14 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 4 Jan 2024 11:03:42 -0600 Subject: [PATCH 5/9] Update deprecated field for network data source and resource --- ibm/service/power/data_source_ibm_pi_network.go | 13 +++---------- ibm/service/power/resource_ibm_pi_network.go | 2 +- website/docs/d/pi_network.html.markdown | 2 +- website/docs/r/pi_network.html.markdown | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_network.go b/ibm/service/power/data_source_ibm_pi_network.go index 397d63ed138..65e75af5498 100644 --- a/ibm/service/power/data_source_ibm_pi_network.go +++ b/ibm/service/power/data_source_ibm_pi_network.go @@ -63,19 +63,15 @@ func DataSourceIBMPINetwork() *schema.Resource { Type: schema.TypeFloat, Computed: true, }, - "name": { - Type: schema.TypeString, - Computed: true, - Deprecated: "This field is deprecated, use pi_network_name instead", - }, "dns": { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, "jumbo": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Deprecated: "This field is deprecated, use mtu instead.", }, "mtu": { Type: schema.TypeInt, @@ -123,9 +119,6 @@ func dataSourceIBMPINetworkRead(ctx context.Context, d *schema.ResourceData, met if networkdata.IPAddressMetrics.Utilization != nil { d.Set("used_ip_percent", networkdata.IPAddressMetrics.Utilization) } - if networkdata.Name != nil { - d.Set("name", networkdata.Name) - } if len(networkdata.DNSServers) > 0 { d.Set("dns", networkdata.DNSServers) } diff --git a/ibm/service/power/resource_ibm_pi_network.go b/ibm/service/power/resource_ibm_pi_network.go index 49e85d9aa5f..af9b53cdd68 100644 --- a/ibm/service/power/resource_ibm_pi_network.go +++ b/ibm/service/power/resource_ibm_pi_network.go @@ -78,7 +78,7 @@ func ResourceIBMPINetwork() *schema.Resource { Type: schema.TypeBool, Optional: true, Computed: true, - Deprecated: "deprecated use pi_network_mtu instead", + Deprecated: "This field is deprecated, use pi_network_mtu instead.", ExactlyOneOf: []string{helpers.PINetworkMtu, helpers.PINetworkJumbo}, Description: "PI network enable MTU Jumbo option", }, diff --git a/website/docs/d/pi_network.html.markdown b/website/docs/d/pi_network.html.markdown index c4f03cb824a..8130cf65ff5 100644 --- a/website/docs/d/pi_network.html.markdown +++ b/website/docs/d/pi_network.html.markdown @@ -53,6 +53,6 @@ In addition to all argument reference list, you can access the following attribu - `used_ip_count` - (Float) The number of used IP addresses. - `used_ip_percent` - (Float) The percentage of IP addresses used. - `vlan_id` - (String) The VLAN ID that the network is connected to. -- `jumbo` - (Bool) MTU Jumbo option of the network (for multi-zone locations only). `deprecated` +- `jumbo` - (Deprecated, Bool) MTU Jumbo option of the network (for multi-zone locations only). - `mtu` - (Bool) Maximum Transmission Unit option of the network. - `access_config` - (String) The network communication configuration option of the network (for satellite locations only). \ No newline at end of file diff --git a/website/docs/r/pi_network.html.markdown b/website/docs/r/pi_network.html.markdown index 4abefe76946..a48ce11c103 100644 --- a/website/docs/r/pi_network.html.markdown +++ b/website/docs/r/pi_network.html.markdown @@ -69,7 +69,7 @@ Review the argument references that you can specify for your resource. The `pi_ipaddress_range` block supports: - `pi_ending_ip_address` - (Required, String) The ending ip address. - `pi_starting_ip_address` - (Required, String) The staring ip address. **Note** if the `pi_gateway` or `pi_ipaddress_range` is not provided, it will calculate the value based on CIDR respectively. -- `pi_network_jumbo` - (Optional, Bool) MTU Jumbo option of the network (for multi-zone locations only). `deprecated` use `pi_network_mtu` instead. +- `pi_network_jumbo` - (Deprecated, Optional, Bool) MTU Jumbo option of the network (for multi-zone locations only). - `pi_network_mtu` - (Optional, Integer) Maximum Transmission Unit option of the network, min size = 1450 & max size = 9000. - `pi_network_access_config` - (Optional, String) The network communication configuration option of the network (for satellite locations only). From d5455f61a46911bd32c3609519d7f0a71bf70435 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 4 Jan 2024 11:04:32 -0600 Subject: [PATCH 6/9] Remove deprecated field for network port attach data resource --- ibm/service/power/resource_ibm_pi_network_port_attach.go | 6 ------ website/docs/r/pi_network_port_attach.html.markdown | 1 - 2 files changed, 7 deletions(-) diff --git a/ibm/service/power/resource_ibm_pi_network_port_attach.go b/ibm/service/power/resource_ibm_pi_network_port_attach.go index 243bc87cb2f..e0e342e15a4 100644 --- a/ibm/service/power/resource_ibm_pi_network_port_attach.go +++ b/ibm/service/power/resource_ibm_pi_network_port_attach.go @@ -69,11 +69,6 @@ func ResourceIBMPINetworkPortAttach() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "port_id": { - Type: schema.TypeString, - Computed: true, - Deprecated: "This field is deprecated, use network_port_id instead", - }, "network_port_id": { Type: schema.TypeString, Computed: true, @@ -169,7 +164,6 @@ func resourceIBMPINetworkPortAttachRead(ctx context.Context, d *schema.ResourceD d.Set("macaddress", networkdata.MacAddress) d.Set("status", networkdata.Status) d.Set("network_port_id", networkdata.PortID) - d.Set("port_id", networkdata.PortID) d.Set("public_ip", networkdata.ExternalIP) return nil diff --git a/website/docs/r/pi_network_port_attach.html.markdown b/website/docs/r/pi_network_port_attach.html.markdown index ff2c3857911..1beb24f4a71 100644 --- a/website/docs/r/pi_network_port_attach.html.markdown +++ b/website/docs/r/pi_network_port_attach.html.markdown @@ -61,7 +61,6 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The unique identifier of the instance. The ID is composed of `//`. - `macaddress` - (String) The MAC address of the port. - `network_port_id` - (String) The ID of the port. -- `port_id` - (Deprecated, String) The ID of the port. - `public_ip` - (String) The public IP associated with the port. - `status` - (String) The status of the port. From e6859de31e04b267389447d65f5fd31dfb74c19c Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 4 Jan 2024 11:04:51 -0600 Subject: [PATCH 7/9] Remove deprecated fields for snapshot resource --- ibm/service/power/resource_ibm_pi_snapshot.go | 16 ---------------- website/docs/r/pi_snapshot.html.markdown | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/ibm/service/power/resource_ibm_pi_snapshot.go b/ibm/service/power/resource_ibm_pi_snapshot.go index 2372e889ed3..17b75a371ec 100644 --- a/ibm/service/power/resource_ibm_pi_snapshot.go +++ b/ibm/service/power/resource_ibm_pi_snapshot.go @@ -63,20 +63,8 @@ func ResourceIBMPISnapshot() *schema.Resource { Optional: true, Description: "Description of the PVM instance snapshot", }, - "description": { - Type: schema.TypeString, - Optional: true, - Description: "Snapshot description", - Deprecated: "This field is deprecated, use pi_description instead", - }, // Computed Attributes - helpers.PISnapshot: { - Type: schema.TypeString, - Computed: true, - Description: "Id of the snapshot", - Deprecated: "This field is deprecated, use snapshot_id instead", - }, "snapshot_id": { Type: schema.TypeString, Computed: true, @@ -114,9 +102,6 @@ func resourceIBMPISnapshotCreate(ctx context.Context, d *schema.ResourceData, me name := d.Get(helpers.PISnapshotName).(string) var description string - if v, ok := d.GetOk("description"); ok { - description = v.(string) - } if v, ok := d.GetOk("pi_description"); ok { description = v.(string) } @@ -167,7 +152,6 @@ func resourceIBMPISnapshotRead(ctx context.Context, d *schema.ResourceData, meta } d.Set(helpers.PISnapshotName, snapshotdata.Name) - d.Set(helpers.PISnapshot, *snapshotdata.SnapshotID) d.Set("snapshot_id", *snapshotdata.SnapshotID) d.Set("status", snapshotdata.Status) d.Set("creation_date", snapshotdata.CreationDate.String()) diff --git a/website/docs/r/pi_snapshot.html.markdown b/website/docs/r/pi_snapshot.html.markdown index 59d4885f29a..e16eac403fb 100644 --- a/website/docs/r/pi_snapshot.html.markdown +++ b/website/docs/r/pi_snapshot.html.markdown @@ -58,7 +58,7 @@ Review the argument references that you can specify for your resource. ## Attribute reference In addition to all argument reference list, you can access the following attribute reference after your resource is created. -- `id` - (String) The unique identifier of the snapshot. The ID is composed of /. +- `id` - (String) The unique identifier of the snapshot. The ID is composed of /. - `snapshot_id` - (String) ID of the PVM instance snapshot. - `status` - (String) Status of the PVM instance snapshot. - `creation_date` - (String) Creation Date. @@ -67,7 +67,7 @@ In addition to all argument reference list, you can access the following attribu ## Import -The `ibm_pi_snapshot` resource can be imported by using `power_instance_id` and `pi_snap_shot_id`. +The `ibm_pi_snapshot` resource can be imported by using `power_instance_id` and `snapshot_id`. **Example** From 13b8b4c6f6151a6907d26a4e6ef7c8b865be015d Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Wed, 10 Jan 2024 15:45:07 -0600 Subject: [PATCH 8/9] Remove deprecated ibm_pi_network_port resource --- .../power/resource_ibm_pi_network_port.go | 211 ------------------ .../resource_ibm_pi_network_port_test.go | 109 --------- website/docs/r/pi_network_port.html.markdown | 75 ------- .../r/pi_network_port_attach.html.markdown | 2 +- 4 files changed, 1 insertion(+), 396 deletions(-) delete mode 100644 ibm/service/power/resource_ibm_pi_network_port.go delete mode 100644 ibm/service/power/resource_ibm_pi_network_port_test.go delete mode 100644 website/docs/r/pi_network_port.html.markdown diff --git a/ibm/service/power/resource_ibm_pi_network_port.go b/ibm/service/power/resource_ibm_pi_network_port.go deleted file mode 100644 index 6b1ffb0cf7b..00000000000 --- a/ibm/service/power/resource_ibm_pi_network_port.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright IBM Corp. 2017, 2021 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package power - -import ( - "context" - "fmt" - "log" - "time" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "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/power/models" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" -) - -func ResourceIBMPINetworkPort() *schema.Resource { - return &schema.Resource{ - CreateContext: resourceIBMPINetworkPortCreate, - ReadContext: resourceIBMPINetworkPortRead, - UpdateContext: resourceIBMPINetworkPortUpdate, - DeleteContext: resourceIBMPINetworkPortDelete, - Importer: &schema.ResourceImporter{}, - - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(60 * time.Minute), - Delete: schema.DefaultTimeout(60 * time.Minute), - }, - - Schema: map[string]*schema.Schema{ - helpers.PINetworkName: { - Type: schema.TypeString, - Required: true, - }, - helpers.PICloudInstanceId: { - Type: schema.TypeString, - Required: true, - }, - helpers.PINetworkPortDescription: { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - helpers.PINetworkPortIPAddress: { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - //Computed Attributes - "macaddress": { - Type: schema.TypeString, - Computed: true, - }, - "portid": { - Type: schema.TypeString, - Computed: true, - }, - "status": { - Type: schema.TypeString, - Computed: true, - }, - "public_ip": { - Type: schema.TypeString, - Computed: true, - }, - }, - DeprecationMessage: "Resource ibm_pi_network_port is deprecated. Use ibm_pi_network_port_attach to create & attach a network port to a pvm instance", - } -} - -func resourceIBMPINetworkPortCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - sess, err := meta.(conns.ClientSession).IBMPISession() - if err != nil { - return diag.FromErr(err) - } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - networkname := d.Get(helpers.PINetworkName).(string) - description := d.Get(helpers.PINetworkPortDescription).(string) - - ipaddress := d.Get(helpers.PINetworkPortIPAddress).(string) - - nwportBody := &models.NetworkPortCreate{Description: description} - - if ipaddress != "" { - log.Printf("IP address provided. ") - nwportBody.IPAddress = ipaddress - } - - client := st.NewIBMPINetworkClient(ctx, sess, cloudInstanceID) - - networkPortResponse, err := client.CreatePort(networkname, nwportBody) - if err != nil { - return diag.FromErr(err) - } - - log.Printf("Printing the networkresponse %+v", &networkPortResponse) - - IBMPINetworkPortID := *networkPortResponse.PortID - - d.SetId(fmt.Sprintf("%s/%s/%s", cloudInstanceID, networkname, IBMPINetworkPortID)) - - _, err = isWaitForIBMPINetworkPortAvailable(ctx, client, IBMPINetworkPortID, networkname, d.Timeout(schema.TimeoutCreate)) - if err != nil { - return diag.FromErr(err) - } - - return resourceIBMPINetworkPortRead(ctx, d, meta) -} - -func resourceIBMPINetworkPortRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - sess, err := meta.(conns.ClientSession).IBMPISession() - if err != nil { - return diag.FromErr(err) - } - - parts, err := flex.IdParts(d.Id()) - if err != nil { - return diag.FromErr(err) - } - cloudInstanceID := parts[0] - networkname := parts[1] - portID := parts[2] - - networkC := st.NewIBMPINetworkClient(ctx, sess, cloudInstanceID) - networkdata, err := networkC.GetPort(networkname, portID) - if err != nil { - return diag.FromErr(err) - } - - d.Set(helpers.PINetworkPortIPAddress, networkdata.IPAddress) - d.Set(helpers.PINetworkPortDescription, networkdata.Description) - d.Set("macaddress", networkdata.MacAddress) - d.Set("status", networkdata.Status) - d.Set("portid", networkdata.PortID) - d.Set("public_ip", networkdata.ExternalIP) - - return nil -} - -func resourceIBMPINetworkPortUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - return nil -} - -func resourceIBMPINetworkPortDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - - log.Printf("Calling the network delete functions. ") - sess, err := meta.(conns.ClientSession).IBMPISession() - if err != nil { - return diag.FromErr(err) - } - - parts, err := flex.IdParts(d.Id()) - if err != nil { - return diag.FromErr(err) - } - cloudInstanceID := parts[0] - networkname := parts[1] - portID := parts[2] - - client := st.NewIBMPINetworkClient(ctx, sess, cloudInstanceID) - - log.Printf("Calling the delete with the following params delete with cloud instance (%s) and networkid (%s) and portid (%s) ", cloudInstanceID, networkname, portID) - err = client.DeletePort(networkname, portID) - if err != nil { - return diag.FromErr(err) - } - - d.SetId("") - return nil -} - -func isWaitForIBMPINetworkPortAvailable(ctx context.Context, client *st.IBMPINetworkClient, id string, networkname string, timeout time.Duration) (interface{}, error) { - log.Printf("Waiting for Power Network (%s) that was created for Network Zone (%s) to be available.", id, networkname) - - stateConf := &resource.StateChangeConf{ - Pending: []string{"retry", helpers.PINetworkProvisioning}, - Target: []string{"DOWN"}, - Refresh: isIBMPINetworkPortRefreshFunc(client, id, networkname), - Timeout: timeout, - Delay: 10 * time.Second, - MinTimeout: 10 * time.Minute, - } - - return stateConf.WaitForStateContext(ctx) -} - -func isIBMPINetworkPortRefreshFunc(client *st.IBMPINetworkClient, id, networkname string) resource.StateRefreshFunc { - - log.Printf("Calling the IsIBMPINetwork Refresh Function....with the following id (%s) for network port and following id (%s) for network name and waiting for network to be READY", id, networkname) - return func() (interface{}, string, error) { - network, err := client.GetPort(networkname, id) - if err != nil { - return nil, "", err - } - - if network.PortID != nil { - //if network.State == "available" { - log.Printf(" The port has been created with the following ip address and attached to an instance ") - return network, "DOWN", nil - } - - return network, helpers.PINetworkProvisioning, nil - } -} diff --git a/ibm/service/power/resource_ibm_pi_network_port_test.go b/ibm/service/power/resource_ibm_pi_network_port_test.go deleted file mode 100644 index 65f72d71686..00000000000 --- a/ibm/service/power/resource_ibm_pi_network_port_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright IBM Corp. 2017, 2021 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package power_test - -import ( - "context" - "errors" - "fmt" - "testing" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - st "github.com/IBM-Cloud/power-go-client/clients/instance" -) - -func TestAccIBMPINetworkPortbasic(t *testing.T) { - name := fmt.Sprintf("tf-pi-network-port-%d", acctest.RandIntRange(10, 100)) - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIBMPINetworkPortDestroy, - Steps: []resource.TestStep{ - { - Config: testAccCheckIBMPINetworkPortConfig(name), - Check: resource.ComposeTestCheckFunc( - testAccCheckIBMPINetworkPortExists("ibm_pi_network_port.power_network_port"), - resource.TestCheckResourceAttr( - "ibm_pi_network_port.power_network_port", "pi_network_name", name), - ), - }, - }, - }) -} -func testAccCheckIBMPINetworkPortDestroy(s *terraform.State) error { - sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() - if err != nil { - return err - } - for _, rs := range s.RootModule().Resources { - if rs.Type != "ibm_pi_network_port" { - continue - } - parts, err := flex.IdParts(rs.Primary.ID) - if err != nil { - return err - } - cloudInstanceID := parts[0] - networkname := parts[1] - portID := parts[2] - networkC := st.NewIBMPINetworkClient(context.Background(), sess, cloudInstanceID) - _, err = networkC.GetPort(networkname, portID) - if err == nil { - return fmt.Errorf("PI Network Port still exists: %s", rs.Primary.ID) - } - } - - return nil -} -func testAccCheckIBMPINetworkPortExists(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - - rs, ok := s.RootModule().Resources[n] - - if !ok { - return fmt.Errorf("Not found: %s", n) - } - - if rs.Primary.ID == "" { - return errors.New("No Record ID is set") - } - - sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() - if err != nil { - return err - } - parts, err := flex.IdParts(rs.Primary.ID) - if err != nil { - return err - } - cloudInstanceID := parts[0] - networkname := parts[1] - portID := parts[2] - client := st.NewIBMPINetworkClient(context.Background(), sess, cloudInstanceID) - - _, err = client.GetPort(networkname, portID) - if err != nil { - return err - } - return nil - - } -} - -func testAccCheckIBMPINetworkPortConfig(name string) string { - return testAccCheckIBMPINetworkConfig(name) + fmt.Sprintf(` - resource "ibm_pi_network_port" "power_network_port" { - pi_cloud_instance_id = "%s" - pi_network_name = ibm_pi_network.power_networks.pi_network_name - pi_network_port_description = "IP Reserved for Test UAT" - } - `, acc.Pi_cloud_instance_id) -} diff --git a/website/docs/r/pi_network_port.html.markdown b/website/docs/r/pi_network_port.html.markdown deleted file mode 100644 index afcb10662ef..00000000000 --- a/website/docs/r/pi_network_port.html.markdown +++ /dev/null @@ -1,75 +0,0 @@ ---- - -subcategory: "Power Systems" -layout: "ibm" -page_title: "IBM: pi_network_port" -description: |- - Manages an Network Port in the Power Virtual Server Cloud. A network port is equivalent to reserving an IP in the subnet. - When the port is created the status will be "DOWN". This network port however is not attached to an instance. ---- - -# ibm_pi_network_port -Creates or updates network port in the Power Virtual Server Cloud. For more information, about network in IBM power virutal server, see [adding or removing a public network -](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-modifying-server#adding-removing-network).. - -## Example usage - -In the following example, you can create an network_port: - -```terraform -resource "ibm_pi_network_port" "test-network-port" { - pi_network_name = "Zone1-CFN" - pi_cloud_instance_id = "51e1879c-bcbe-4ee1-a008-49cdba0eaf60" - pi_network_port_description = "IP Reserved for Oracle RAC " -} -``` - -**Note** -* 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" - zone = "lon04" - } - ``` - -## Timeouts - -ibm_pi_network_port provides the following [timeouts](https://www.terraform.io/docs/language/resources/syntax.html) configuration options: - -- **create** - (Default 60 minutes) Used for creating a network_port. -- **delete** - (Default 60 minutes) Used for deleting a network_port. - -## Argument reference -Review the argument references that you can specify for your resource. - -- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. -- `pi_network_name` - (Required, String) Network ID or name. -- `pi_network_port_description` - (Optional, String) The description for the Network Port. -- `pi_network_port_ipaddress` - (Optional, String) The requested ip address of this port. - -## Attribute reference -In addition to all argument reference list, you can access the following attribute reference after your resource is created. - -- `id` - (String) The unique identifier of the instance. The ID is composed of `//`. -- `macaddress` - (String) The MAC address of the port. -- `portid` - (String) The ID of the port. -- `public_ip` - (String) The public IP associated with the port. -- `status` - (String) The status of the port. - - -## Import - -The `ibm_pi_network_port` resource can be imported by using `power_instance_id`, `port_id` and `pi_network_name`. - -**Example** - -``` -$ terraform import ibm_pi_network_port.example d7bec597-4726-451f-8a63-e62e6f19c32c/cea6651a-bc0a-4438-9f8a-a0770bbf3ebb/network-name -``` diff --git a/website/docs/r/pi_network_port_attach.html.markdown b/website/docs/r/pi_network_port_attach.html.markdown index 1beb24f4a71..b12d5b2a7f2 100644 --- a/website/docs/r/pi_network_port_attach.html.markdown +++ b/website/docs/r/pi_network_port_attach.html.markdown @@ -67,7 +67,7 @@ In addition to all argument reference list, you can access the following attribu ## Import -The `ibm_pi_network_port` resource can be imported by using `power_instance_id`, `pi_network_name` and `port_id`. +The `ibm_pi_network_port` resource can be imported by using `power_instance_id`, `pi_network_name` and `network_port_id`. **Example** From d43df74d54a8da2edcb5b05af86d64de53f043d0 Mon Sep 17 00:00:00 2001 From: Axel Ismirlian Date: Thu, 11 Jan 2024 11:39:22 -0600 Subject: [PATCH 9/9] Remove deprecated network port resource from provider --- ibm/provider/provider.go | 1 - 1 file changed, 1 deletion(-) diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 0bf1e29b215..08d9d91b249 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -1172,7 +1172,6 @@ func Provider() *schema.Provider { "ibm_pi_capture": power.ResourceIBMPICapture(), "ibm_pi_image": power.ResourceIBMPIImage(), "ibm_pi_image_export": power.ResourceIBMPIImageExport(), - "ibm_pi_network_port": power.ResourceIBMPINetworkPort(), "ibm_pi_snapshot": power.ResourceIBMPISnapshot(), "ibm_pi_network_port_attach": power.ResourceIBMPINetworkPortAttach(), "ibm_pi_dhcp": power.ResourceIBMPIDhcp(),