diff --git a/huaweicloud/resource_huaweicloud_compute_instance_v2.go b/huaweicloud/resource_huaweicloud_compute_instance_v2.go index f9e3794f78..c6ee63152d 100644 --- a/huaweicloud/resource_huaweicloud_compute_instance_v2.go +++ b/huaweicloud/resource_huaweicloud_compute_instance_v2.go @@ -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, @@ -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 @@ -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{}))) diff --git a/website/docs/r/compute_instance_v2.html.markdown b/website/docs/r/compute_instance_v2.html.markdown index dac74f585d..abcefc4aa9 100644 --- a/website/docs/r/compute_instance_v2.html.markdown +++ b/website/docs/r/compute_instance_v2.html.markdown @@ -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: