Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Use management designation to determine access IPs
Browse files Browse the repository at this point in the history
  • Loading branch information
bzub committed Sep 6, 2017
1 parent 7510853 commit 6146b61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
19 changes: 11 additions & 8 deletions packet/resource_packet_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,19 @@ func resourcePacketDeviceRead(d *schema.ResourceData, meta interface{}) error {
}
networks = append(networks, network)

if ip.AddressFamily == 4 {
if ip.Public == true {
host = ip.Address
ipv4SubnetSize = ip.CIDR
d.Set("access_public_ipv4", ip.Address)
// Initial device IPs are fixed and marked as "Management"
if ip.Management {
if ip.AddressFamily == 4 {
if ip.Public {
host = ip.Address
ipv4SubnetSize = ip.CIDR
d.Set("access_public_ipv4", ip.Address)
} else {
d.Set("access_private_ipv4", ip.Address)
}
} else {
d.Set("access_private_ipv4", ip.Address)
d.Set("access_public_ipv6", ip.Address)
}
} else {
d.Set("access_public_ipv6", ip.Address)
}
}
d.Set("network", networks)
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/packethost/packngo/ip.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,12 @@
"revisionTime": "2016-10-03T17:45:16Z"
},
{
"checksumSHA1": "IV/ufjfpq6nYH2v3Y583Nwx3a+8=",
"checksumSHA1": "DxROQsabA/KchJMOyyV92KquswQ=",
"path": "github.com/packethost/packngo",
"revision": "36f34102fc1464824b8069cbd65ad5a0185d2dc7",
"revisionTime": "2017-09-01T15:06:29Z"
"revision": "b467bc62ab07434fb341df598ec2c7d9fe2e30d6",
"revisionTime": "2017-09-06T14:46:34Z",
"version": "master",
"versionExact": "master"
},
{
"checksumSHA1": "rTNABfFJ9wtLQRH8uYNkEZGQOrY=",
Expand Down

0 comments on commit 6146b61

Please sign in to comment.