Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECS] Fix issue with multiple networks #1057

Merged
merged 4 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/jen20/awspolicyequivalence v1.1.0
github.com/jinzhu/copier v0.2.3
github.com/mitchellh/go-homedir v1.1.0
github.com/opentelekomcloud/gophertelekomcloud v0.3.3-0.20210504154301-ea895669e707
github.com/opentelekomcloud/gophertelekomcloud v0.3.3-0.20210513155845-aa4509827820
github.com/unknwon/com v1.0.1
gopkg.in/yaml.v2 v2.4.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWb
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/opentelekomcloud/gophertelekomcloud v0.3.3-0.20210504154301-ea895669e707 h1:V1YQglGVFvt2l2anaTQO4sRlhnhajQZSbg6fRPPsrsI=
github.com/opentelekomcloud/gophertelekomcloud v0.3.3-0.20210504154301-ea895669e707/go.mod h1:pzEP1kduNwv+hrI9R6/DFU/NiX7Kr9NiFjpQ7kJQTsM=
github.com/opentelekomcloud/gophertelekomcloud v0.3.3-0.20210513155845-aa4509827820 h1:FV3zLfaCqsN07tJZu/AMKtv71XX5v1593VXZFKnqrLI=
github.com/opentelekomcloud/gophertelekomcloud v0.3.3-0.20210513155845-aa4509827820/go.mod h1:pzEP1kduNwv+hrI9R6/DFU/NiX7Kr9NiFjpQ7kJQTsM=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ resource "opentelekomcloud_compute_instance_v2" "instance_1" {
]
name = "instance_1"
security_groups = ["default"]

network {
uuid = "%s"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,17 +548,17 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err

mErr = multierror.Append(mErr,
d.Set("network", networks),
d.Set("access_ip_v4", hostv4),
d.Set("access_ip_v6", hostv6),
d.Set("access_ip_v4", server.AccessIPv4),
d.Set("access_ip_v6", server.AccessIPv6),
)

// Determine the best IP address to use for SSH connectivity.
// Prefer IPv4 over IPv6.
var preferredSSHAddress string
if hostv4 != "" {
preferredSSHAddress = hostv4
} else if hostv6 != "" {
preferredSSHAddress = hostv6
if server.AccessIPv4 != "" {
preferredSSHAddress = server.AccessIPv4
} else if server.AccessIPv6 != "" {
preferredSSHAddress = server.AccessIPv6
}

if preferredSSHAddress != "" {
Expand Down