Skip to content

Commit

Permalink
Add op_svc_userid support to ecs_instance (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
niuzhenguo authored Jan 11, 2020
1 parent f79d47b commit 92a01b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions huaweicloud/resource_huaweicloud_ecs_instance_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ func resourceEcsInstanceV1() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"op_svc_userid": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
},
}
}
Expand Down Expand Up @@ -246,6 +251,14 @@ func resourceEcsInstanceV1Create(d *schema.ResourceData, meta interface{}) error
createOpts.ExtendParam = &extendParam
}

var metadata cloudservers.MetaData
if hasFilledOpt(d, "op_svc_userid") {
metadata.OpSvcUserId = d.Get("op_svc_userid").(string)
}
if metadata != (cloudservers.MetaData{}) {
createOpts.MetaData = &metadata
}

log.Printf("[DEBUG] Create Options: %#v", createOpts)

var instance_id string
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/ecs_instance_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ The following arguments are supported:

* `tags` - (Optional) Tags key/value pairs to associate with the instance.

* `op_svc_userid` - (Optional) User ID, required when using key_name. Changing this creates a new server.


The `nics` block supports:

Expand Down

0 comments on commit 92a01b4

Please sign in to comment.