Skip to content

Commit 7071a24

Browse files
committed
refactor: rename 'projectid' to 'project' for consistency across data source and resource limits
1 parent a6cbbfa commit 7071a24

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

cloudstack/data_source_cloudstack_limits.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func dataSourceCloudStackLimits() *schema.Resource {
5454
Optional: true,
5555
Description: "List only resources belonging to the domain specified.",
5656
},
57-
"projectid": {
57+
"project": {
5858
Type: schema.TypeString,
5959
Optional: true,
6060
Description: "List resource limits by project.",
@@ -127,7 +127,7 @@ func dataSourceCloudStackLimitsRead(d *schema.ResourceData, meta interface{}) er
127127
p.SetDomainid(v.(string))
128128
}
129129

130-
if v, ok := d.GetOk("projectid"); ok {
130+
if v, ok := d.GetOk("project"); ok {
131131
p.SetProjectid(v.(string))
132132
}
133133

@@ -200,7 +200,7 @@ func generateDataSourceID(d *schema.ResourceData) string {
200200
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
201201
}
202202

203-
if v, ok := d.GetOk("projectid"); ok {
203+
if v, ok := d.GetOk("project"); ok {
204204
buf.WriteString(fmt.Sprintf("%s-", v.(string)))
205205
}
206206

cloudstack/resource_cloudstack_limits.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func resourceCloudStackLimits() *schema.Resource {
8787
Computed: true,
8888
Description: "Internal field to track the originally configured max value to distinguish between 0 and -1 when CloudStack returns -1.",
8989
},
90-
"projectid": {
90+
"project": {
9191
Type: schema.TypeString,
9292
Optional: true,
9393
ForceNew: true,
@@ -205,7 +205,7 @@ func resourceCloudStackLimitsCreate(d *schema.ResourceData, meta interface{}) er
205205

206206
account := d.Get("account").(string)
207207
domain_id := d.Get("domain_id").(string)
208-
projectid := d.Get("projectid").(string)
208+
projectid := d.Get("project").(string)
209209

210210
// Validate account and domain parameters
211211
if account != "" && domain_id == "" {
@@ -300,8 +300,8 @@ func resourceCloudStackLimitsRead(d *schema.ResourceData, meta interface{}) erro
300300
}
301301
} else if idParts[1] == "project" {
302302
// Format: resourcetype-project-projectid
303-
if err := d.Set("projectid", idParts[2]); err != nil {
304-
return fmt.Errorf("error setting projectid: %s", err)
303+
if err := d.Set("project", idParts[2]); err != nil {
304+
return fmt.Errorf("error setting project: %s", err)
305305
}
306306
} else if idParts[1] == "account" && len(idParts) >= 4 {
307307
// Format: resourcetype-account-account-domain_id
@@ -319,7 +319,7 @@ func resourceCloudStackLimitsRead(d *schema.ResourceData, meta interface{}) erro
319319

320320
account := d.Get("account").(string)
321321
domain_id := d.Get("domain_id").(string)
322-
projectid := d.Get("projectid").(string)
322+
projectid := d.Get("project").(string)
323323

324324
// Create a new parameter struct
325325
p := cs.Limit.NewListResourceLimitsParams()
@@ -397,7 +397,7 @@ func resourceCloudStackLimitsUpdate(d *schema.ResourceData, meta interface{}) er
397397

398398
account := d.Get("account").(string)
399399
domain_id := d.Get("domain_id").(string)
400-
projectid := d.Get("projectid").(string)
400+
projectid := d.Get("project").(string)
401401

402402
// Create a new parameter struct
403403
p := cs.Limit.NewUpdateResourceLimitParams(resourcetype)
@@ -443,7 +443,7 @@ func resourceCloudStackLimitsDelete(d *schema.ResourceData, meta interface{}) er
443443

444444
account := d.Get("account").(string)
445445
domain_id := d.Get("domain_id").(string)
446-
projectid := d.Get("projectid").(string)
446+
projectid := d.Get("project").(string)
447447

448448
// Create a new parameter struct
449449
p := cs.Limit.NewUpdateResourceLimitParams(resourcetype)

website/docs/d/limits.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ data "cloudstack_limits" "account_instance_limits" {
2828
# Get primary storage limits for a project
2929
data "cloudstack_limits" "project_storage_limits" {
3030
type = "primarystorage"
31-
projectid = "project-uuid"
31+
project = "project-uuid"
3232
}
3333
```
3434

@@ -51,7 +51,7 @@ The following arguments are supported:
5151
* `secondarystorage`
5252
* `account` - (Optional) List resources by account. Must be used with the `domainid` parameter.
5353
* `domainid` - (Optional) List only resources belonging to the domain specified.
54-
* `projectid` - (Optional) List resource limits by project.
54+
* `project` - (Optional) List resource limits by project.
5555

5656
## Attributes Reference
5757

website/docs/r/limits.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ resource "cloudstack_limits" "volume_limit" {
3131
resource "cloudstack_limits" "storage_limit" {
3232
type = "primarystorage"
3333
max = 1000 # GB
34-
projectid = "project-uuid"
34+
project = "project-uuid"
3535
}
3636
3737
# Set unlimited CPU limit
@@ -62,7 +62,7 @@ The following arguments are supported:
6262
* `account` - (Optional, ForceNew) Update resource for a specified account. Must be used with the `domainid` parameter.
6363
* `domainid` - (Optional, ForceNew) Update resource limits for all accounts in specified domain. If used with the `account` parameter, updates resource limits for a specified account in specified domain.
6464
* `max` - (Optional) Maximum resource limit. Use `-1` for unlimited resource limit. A value of `0` means zero resources are allowed, though the CloudStack API may return `-1` for a limit set to `0`.
65-
* `projectid` - (Optional, ForceNew) Update resource limits for project.
65+
* `project` - (Optional, ForceNew) Update resource limits for project.
6666

6767
## Attributes Reference
6868

@@ -73,7 +73,7 @@ The following attributes are exported:
7373
* `max` - The maximum number of the resource.
7474
* `account` - The account of the resource limit.
7575
* `domainid` - The domain ID of the resource limit.
76-
* `projectid` - The project ID of the resource limit.
76+
* `project` - The project ID of the resource limit.
7777

7878
## Import
7979

0 commit comments

Comments
 (0)