Skip to content

Commit

Permalink
provider/openstack: Re-Add server.AccessIPv4 and server.AccessIPv6
Browse files Browse the repository at this point in the history
hashicorpGH-4812 removed reading server.AccessIPv4 and server.AccessIPv6
because, AFAICT, they are not set by Nova. After removal, a user
reported that they were no longer able to read IPs from access_ip_v4
and access_ip_v6 on Rackspace. It's possible that Rackspace sets
the AccessIPv* attributes, and if that's true, other cloud providers
might as well through custom extensions.

The priority of how access_ip_v* is set might require some tweaks in
the future.
  • Loading branch information
jtopjian authored and bigkraig committed Mar 1, 2016
1 parent 502a497 commit 021b97b
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,14 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err
// Determine the best IPv4 and IPv6 addresses to access the instance with
hostv4, hostv6 := getInstanceAccessAddresses(d, networks)

if server.AccessIPv4 != "" && hostv4 == "" {
hostv4 = server.AccessIPv4
}

if server.AccessIPv6 != "" && hostv6 == "" {
hostv6 = server.AccessIPv6
}

d.Set("network", networks)
d.Set("access_ip_v4", hostv4)
d.Set("access_ip_v6", hostv6)
Expand Down

0 comments on commit 021b97b

Please sign in to comment.