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

Add support for compute_instance to specify deh host #253

Merged
merged 1 commit into from
Dec 20, 2019
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
20 changes: 20 additions & 0 deletions huaweicloud/resource_huaweicloud_compute_instance_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,16 @@ func resourceComputeInstanceV2() *schema.Resource {
Optional: true,
ForceNew: true,
},
"tenancy": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"deh_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
},
},
Set: resourceComputeSchedulerHintsHash,
Expand Down Expand Up @@ -919,6 +929,8 @@ func resourceInstanceSchedulerHintsV2(d *schema.ResourceData, schedulerHintsRaw
Query: query,
TargetCell: schedulerHintsRaw["target_cell"].(string),
BuildNearHostIP: schedulerHintsRaw["build_near_host_ip"].(string),
Tenancy: schedulerHintsRaw["tenancy"].(string),
DedicatedHostID: schedulerHintsRaw["deh_id"].(string),
}

return schedulerHints
Expand Down Expand Up @@ -1032,6 +1044,14 @@ func resourceComputeSchedulerHintsHash(v interface{}) int {
buf.WriteString(fmt.Sprintf("%s-", m["build_host_near_ip"].(string)))
}

if m["tenancy"] != nil {
buf.WriteString(fmt.Sprintf("%s-", m["tenancy"].(string)))
}

if m["deh_id"] != nil {
buf.WriteString(fmt.Sprintf("%s-", m["deh_id"].(string)))
}

buf.WriteString(fmt.Sprintf("%s-", m["different_host"].([]interface{})))
buf.WriteString(fmt.Sprintf("%s-", m["same_host"].([]interface{})))
buf.WriteString(fmt.Sprintf("%s-", m["query"].([]interface{})))
Expand Down
6 changes: 6 additions & 0 deletions website/docs/r/compute_instance_v2.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,12 @@ The `scheduler_hints` block supports:
* `build_near_host_ip` - (Optional) An IP Address in CIDR form. The instance
will be placed on a compute node that is in the same subnet.

* `tenancy` - (Optional) The tenancy specifies whether the ECS is to be created on a Dedicated Host
(DeH) or in a shared pool.

* `deh_id` - (Optional) The ID of DeH. This parameter takes effect only when the value
of tenancy is dedicated.

## Attributes Reference

The following attributes are exported:
Expand Down