Skip to content

Commit

Permalink
added domainid parameter to account resource (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranchavala authored Oct 20, 2024
1 parent 02058b4 commit a653531
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cloudstack/resource_cloudstack_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func resourceCloudStackAccount() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"domainid": {
Type: schema.TypeString,
Optional: true,
},
},
}
}
Expand All @@ -80,6 +84,7 @@ func resourceCloudStackAccountCreate(d *schema.ResourceData, meta interface{}) e
role_id := d.Get("role_id").(string)
account_type := d.Get("account_type").(int)
account := d.Get("account").(string)
domainid := d.Get("domainid").(string)

// Create a new parameter struct
p := cs.Account.NewCreateAccountParams(email, first_name, last_name, password, username)
Expand All @@ -90,6 +95,7 @@ func resourceCloudStackAccountCreate(d *schema.ResourceData, meta interface{}) e
} else {
p.SetAccount(username)
}
p.SetDomainid(domainid)

log.Printf("[DEBUG] Creating Account %s", account)
a, err := cs.Account.CreateAccount(p)
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The following arguments are supported:
* `account_type` - (Required) The account type. Possible values are `0` for regular user, `1` for admin, and `2` for domain admin.
* `role_id` - (Required) The ID of the role associated with the account.
* `account` - (Optional) The account name. If not specified, the username will be used as the account name.
* `domainid` - (Optional) Creates the user under the specified domain

## Attributes Reference

Expand Down

0 comments on commit a653531

Please # to comment.