Skip to content

Commit

Permalink
Deprecate macaddress for mac_address
Browse files Browse the repository at this point in the history
  • Loading branch information
ismirlia committed Jan 14, 2025
1 parent 2a9369a commit a141554
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
7 changes: 7 additions & 0 deletions ibm/service/power/data_source_ibm_pi_instance_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func DataSourceIBMPIInstanceIP() *schema.Resource {
Type: schema.TypeString,
},
Attr_Macaddress: {
Computed: true,
Deprecated: "Deprecated, use mac_address instead",
Description: "The MAC address of the network that is attached to this instance.",
Type: schema.TypeString,
},
Attr_MacAddress: {
Computed: true,
Description: "The MAC address of the network that is attached to this instance.",
Type: schema.TypeString,
Expand Down Expand Up @@ -97,6 +103,7 @@ func dataSourceIBMPIInstancesIPRead(ctx context.Context, d *schema.ResourceData,
d.Set(Attr_ExternalIP, network.ExternalIP)
d.Set(Attr_IP, network.IPAddress)
d.Set(Attr_Macaddress, network.MacAddress)
d.Set(Attr_MacAddress, network.MacAddress)
d.Set(Attr_NetworkID, network.NetworkID)
d.Set(Attr_Type, network.Type)

Expand Down
7 changes: 7 additions & 0 deletions ibm/service/power/data_source_ibm_pi_network_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ func DataSourceIBMPINetworkPort() *schema.Resource {
Type: schema.TypeString,
},
Attr_Macaddress: {
Computed: true,
Deprecated: "Deprecated, use mac_address instead",
Description: "The MAC address of the port.",
Type: schema.TypeString,
},
Attr_MacAddress: {
Computed: true,
Description: "The MAC address of the port.",
Type: schema.TypeString,
Expand Down Expand Up @@ -113,6 +119,7 @@ func flattenNetworkPorts(networkPorts []*models.NetworkPort) interface{} {
Attr_Href: i.Href,
Attr_IPaddress: *i.IPAddress,
Attr_Macaddress: *i.MacAddress,
Attr_MacAddress: *i.MacAddress,
Attr_PortID: *i.PortID,
Attr_PublicIP: i.ExternalIP,
Attr_Status: *i.Status,
Expand Down
10 changes: 7 additions & 3 deletions ibm/service/power/resource_ibm_pi_network_port_attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func ResourceIBMPINetworkPortAttach() *schema.Resource {
Description: "The MAC address of the port.",
Type: schema.TypeString,
},
Attr_Macaddress: {
Computed: true,
Deprecated: "Deprecated, use mac_address instead",
Description: "The MAC address of the instance.",
Type: schema.TypeString,
},
Attr_NetworkPortID: {
Computed: true,
Description: "The ID of the port.",
Expand Down Expand Up @@ -181,6 +187,7 @@ func resourceIBMPINetworkPortAttachRead(ctx context.Context, d *schema.ResourceD
d.Set(Arg_NetworkPortDescription, networkdata.Description)
d.Set(Arg_NetworkPortIPAddress, networkdata.IPAddress)
d.Set(Attr_MacAddress, networkdata.MacAddress)
d.Set(Attr_Macaddress, networkdata.MacAddress)
d.Set(Attr_NetworkPortID, networkdata.PortID)
d.Set(Attr_PublicIP, networkdata.ExternalIP)
d.Set(Attr_Status, networkdata.Status)
Expand All @@ -189,7 +196,6 @@ func resourceIBMPINetworkPortAttachRead(ctx context.Context, d *schema.ResourceD
}

func resourceIBMPINetworkPortAttachDelete(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 {
Expand Down Expand Up @@ -232,7 +238,6 @@ func isWaitForIBMPINetworkportAvailable(ctx context.Context, client *instance.IB
}

func isIBMPINetworkportRefreshFunc(client *instance.IBMPINetworkClient, id, networkname string) retry.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)
Expand Down Expand Up @@ -265,7 +270,6 @@ func isWaitForIBMPINetworkPortAttachAvailable(ctx context.Context, client *insta
}

func isIBMPINetworkPortAttachRefreshFunc(client *instance.IBMPINetworkClient, id, networkname, instanceid string) retry.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)
Expand Down
18 changes: 12 additions & 6 deletions website/docs/d/pi_instance_ip.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ description: |-
---

# ibm_pi_instance_ip

Retrieve information about a Power Systems Virtual Server instance IP address. For more information, about Power Systems Virtual Server instance IP address, see [configuring and adding a private network subnet](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-subnet).

## Example usage

```terraform
data "ibm_pi_instance_ip" "ds_instance_ip" {
pi_instance_name = "terraform-test-instance"
Expand All @@ -18,13 +20,15 @@ data "ibm_pi_instance_ip" "ds_instance_ip" {
}
```

**Notes**
### Notes

- 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"
Expand All @@ -33,20 +37,22 @@ Example usage:
```

## Argument reference
Review the argument references that you can specify for your data source.

Review the argument references that you can specify for your data source.

- `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account.
- `pi_instance_name` - (Required, String) The unique identifier or name of the instance.
- `pi_network_name` - (Required, String) The subnet that the instance belongs to.

- `pi_network_name` - (Required, String) The subnet that the instance belongs to.

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

In addition to all argument reference list, you can access the following attribute references after your data source is created.

- `external_ip` - (String) The external IP of the network that is attached to this instance.
- `id` - (String) The unique identifier of the network.
- `ip` - (String) The IP address that is attached to this instance from the subnet.
- `ipoctet` - (String) The IP octet of the network that is attached to this instance.
- `macaddress` - (String) The MAC address of the network that is attached to this instance.
- `mac_address` - (String) The MAC address of the network that is attached to this instance.
- `macaddress` - (String) The MAC address of the network that is attached to this instance. Deprecated please use `mac_address` instead.
- `network_id` - (String) ID of the network.
- `type` - (String) The type of the network that is attached to this instance.
3 changes: 2 additions & 1 deletion website/docs/d/pi_network_port.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ In addition to all argument reference list, you can access the following attribu
- `description` - (String) The description for the network port.
- `href` - (String) Network port href.
- `ipaddress` - (String) The IP address of the port.
- `macaddress` - (String) The MAC address of the port.
- `mac_address` - (String) The MAC address of the instance.
- `macaddress` - (String) The MAC address of the instance. Deprecated please use `mac_address` instead.
- `portid` - (String) The ID of the port.
- `public_ip`- (String) The public IP associated with the port.
- `status` - (String) The status of the port.
3 changes: 2 additions & 1 deletion website/docs/r/pi_network_port_attach.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ 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 instance. The ID is composed of `<pi_cloud_instance_id>/<pi_network_name>/<network_port_id>`.
- `macaddress` - (String) The MAC address of the port.
- `mac_address` - (String) The MAC address of the instance.
- `macaddress` - (String) The MAC address of the instance. Deprecated please use `mac_address` instead.
- `network_port_id` - (String) The ID of the port.
- `public_ip` - (String) The public IP associated with the port.
- `status` - (String) The status of the port.
Expand Down

0 comments on commit a141554

Please sign in to comment.