Skip to content

Commit

Permalink
exoscale_compute_instance: mac address attribute (#373)
Browse files Browse the repository at this point in the history
We add an attribute for the MAC address to `exoscale_compute_instance`
on the public and private network interfaces.
  • Loading branch information
sauterp authored Jul 26, 2024
1 parent c96e003 commit 397ecbc
Show file tree
Hide file tree
Showing 11 changed files with 266 additions and 122 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

FEATURES:

- exoscale_compute_instance: mac address attribute #373

BUG FIXES:

- fix: allow ICMP Code and Type -1 to 254 #372
Expand Down
5 changes: 5 additions & 0 deletions docs/resources/compute_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ directory for complete configuration examples.
- `created_at` (String) The instance creation date.
- `id` (String) The ID of this resource.
- `ipv6_address` (String) The instance (main network interface) IPv6 address (if enabled).
- `mac_address` (String) MAC address
- `private_network_ids` (Set of String, Deprecated) A list of private networks (IDs) attached to the instance. Please use the `network_interface.*.network_id` argument instead.
- `public_ip_address` (String) The instance (main network interface) IPv4 address.

Expand All @@ -85,6 +86,10 @@ Optional:

- `ip_address` (String) The IPv4 address to request as static DHCP lease if the network interface is attached to a *managed* private network.

Read-Only:

- `mac_address` (String) MAC address


<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/exoscale/terraform-provider-exoscale

require (
github.com/exoscale/egoscale v0.102.4
github.com/exoscale/egoscale/v3 v3.1.0
github.com/exoscale/egoscale/v3 v3.1.1
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/exoscale/egoscale v0.102.4 h1:GBKsZMIOzwBfSu+4ZmWka3Ejf2JLiaBDHp4CQUgvp2E=
github.com/exoscale/egoscale v0.102.4/go.mod h1:ROSmPtle0wvf91iLZb09++N/9BH2Jo9XxIpAEumvocA=
github.com/exoscale/egoscale/v3 v3.1.0 h1:8MSA0j4TZbUiE6iIzTmoY0URa3RoGGuHhX5oamCql4o=
github.com/exoscale/egoscale/v3 v3.1.0/go.mod h1:lPsza7G+giSxdzvzaHSEcjEAYz/YTiu2bEEha9KVAc4=
github.com/exoscale/egoscale/v3 v3.1.1 h1:NwTlXE2sKe2kBWm+c3bsHV+aWDFiEJ9JQpS6X3j4wbc=
github.com/exoscale/egoscale/v3 v3.1.1/go.mod h1:lPsza7G+giSxdzvzaHSEcjEAYz/YTiu2bEEha9KVAc4=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
Expand Down
1 change: 1 addition & 0 deletions pkg/resources/instance/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
AttrID = "id"
AttrIPv6 = "ipv6"
AttrIPv6Address = "ipv6_address"
AttrMACAddress = "mac_address"
AttrLabels = "labels"
AttrManagerID = "manager_id"
AttrManagerType = "manager_type"
Expand Down
5 changes: 3 additions & 2 deletions pkg/resources/instance/nif.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

type NetworkInterface struct {
NetworkID string `json:"network_id"`
IPAddress *string `json:"ip_address"`
NetworkID string `json:"network_id"`
IPAddress *string `json:"ip_address"`
MacAddress string `json:"mac_address"`
}

func NewNetworkInterface(raw interface{}) (*NetworkInterface, error) {
Expand Down
Loading

0 comments on commit 397ecbc

Please sign in to comment.