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

support fault domain in server group and ecs scheduler hints #735

Merged
merged 1 commit into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -7,7 +7,7 @@ require (
github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-cleanhttp v0.5.1
github.com/hashicorp/terraform-plugin-sdk v1.13.0
github.com/huaweicloud/golangsdk v0.0.0-20201204095247-2438ba26b2d9
github.com/huaweicloud/golangsdk v0.0.0-20201208095655-46b6c076ba1b
github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a
github.com/mitchellh/go-homedir v1.1.0
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/huaweicloud/golangsdk v0.0.0-20201204095247-2438ba26b2d9 h1:IgV5RijwKkFEW3e6p3eTVTDx8PKCgB2u6sE2JkVNb4w=
github.com/huaweicloud/golangsdk v0.0.0-20201204095247-2438ba26b2d9/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0=
github.com/huaweicloud/golangsdk v0.0.0-20201208095655-46b6c076ba1b h1:iknqQBENR+tr/hqZRWSmii5KaGODARsUu0WDC8HnlXY=
github.com/huaweicloud/golangsdk v0.0.0-20201208095655-46b6c076ba1b/go.mod h1:fcOI5u+0f62JtJd7zkCch/Z57BNC6bhqb32TKuiF4r0=
github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a h1:FyS/ubzBR5xJlnJGRTwe7GUHpJOR4ukYK3y+LFNffuA=
github.com/jen20/awspolicyequivalence v0.0.0-20170831201602-3d48364a137a/go.mod h1:uoIMjNxUfXi48Ci40IXkPRbghZ1vbti6v9LCbNqRgHY=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
Expand Down
6 changes: 6 additions & 0 deletions huaweicloud/resource_huaweicloud_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ func ResourceComputeInstanceV2() *schema.Resource {
Optional: true,
ForceNew: true,
},
"fault_domain": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"tenancy": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1197,6 +1202,7 @@ func resourceInstanceBlockDevicesV2(d *schema.ResourceData, bds []interface{}) (
func resourceInstanceSchedulerHintsV1(d *schema.ResourceData, schedulerHintsRaw map[string]interface{}) cloudservers.SchedulerHints {
schedulerHints := cloudservers.SchedulerHints{
Group: schedulerHintsRaw["group"].(string),
FaultDomain: schedulerHintsRaw["fault_domain"].(string),
Tenancy: schedulerHintsRaw["tenancy"].(string),
DedicatedHostID: schedulerHintsRaw["deh_id"].(string),
}
Expand Down
14 changes: 8 additions & 6 deletions huaweicloud/resource_huaweicloud_compute_servergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func ResourceComputeServerGroupV2() *schema.Resource {
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"fault_domains": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"value_specs": {
Type: schema.TypeMap,
Optional: true,
Expand Down Expand Up @@ -102,12 +107,9 @@ func resourceComputeServerGroupV2Read(d *schema.ResourceData, meta interface{})
}
d.Set("policies", policies)

// Set the members
members := []string{}
for _, m := range sg.Members {
members = append(members, m)
}
d.Set("members", members)
// Set the members & fault_domains
d.Set("members", sg.Members)
d.Set("fault_domains", sg.FaultDomain.Names)

d.Set("region", GetRegion(d, config))

Expand Down

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

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

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ github.com/hashicorp/terraform-svchost/auth
github.com/hashicorp/terraform-svchost/disco
# github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
github.com/hashicorp/yamux
# github.com/huaweicloud/golangsdk v0.0.0-20201204095247-2438ba26b2d9
# github.com/huaweicloud/golangsdk v0.0.0-20201208095655-46b6c076ba1b
## explicit
github.com/huaweicloud/golangsdk
github.com/huaweicloud/golangsdk/internal
Expand Down