-
Notifications
You must be signed in to change notification settings - Fork 55
feature: add Quota plugin #248
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
feature: add Quota plugin #248
Conversation
|
@jeanvetorello could you fix the failing tests --- PASS: TestAccServiceOfferingUnconstrained (2.41s) |
kiranchavala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM , tested manually
root@ubuntu2404:~/terrfomconfig# cat main.tf
provider "cloudstack" {
api_url = var.cloudstack_api_url
api_key = var.cloudstack_api_key
secret_key = var.cloudstack_secret_key
}
resource "cloudstack_quota_tariff" "test" {
name = "Complex Activation Rule Tariff"
usage_type = 1
value = 0.25
description = "Test tariff with complex activation rule"
activation_rule = "serviceOffering.id == 'f3e56622-8cad-475d-92aa-5495b31768fd' && zone.name == 'ref-trl-9690-k-Mol8-kiran-chavala'"
}
root@ubuntu2404:~/terrfomconfig# terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# cloudstack_quota_tariff.test will be created
+ resource "cloudstack_quota_tariff" "test" {
+ activation_rule = "serviceOffering.id == 'f3e56622-8cad-475d-92aa-5495b31768fd' && zone.name == 'ref-trl-9690-k-Mol8-kiran-chavala'"
+ currency = (known after apply)
+ description = "Test tariff with complex activation rule"
+ effective_date = (known after apply)
+ id = (known after apply)
+ name = "Complex Activation Rule Tariff"
+ position = (known after apply)
+ removed = (known after apply)
+ usage_name = (known after apply)
+ usage_type = 1
+ usage_unit = (known after apply)
+ value = 0.25
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
cloudstack_quota_tariff.test: Creating...
cloudstack_quota_tariff.test: Creation complete after 0s [id=085fb27c-2c73-4359-a315-0ef46d63a98f]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
mysql> select * from quota_tariff where id=23 \G;
*************************** 1. row ***************************
id: 23
usage_type: 1
usage_name: RUNNING_VM
usage_unit: Compute*Month
usage_discriminator: None
currency_value: 0.25000
effective_on: 2025-10-17 06:52:56
updated_on: 2025-10-17 06:52:56
updated_by: 1
uuid: 085fb27c-2c73-4359-a315-0ef46d63a98f
name: Complex Activation Rule Tariff
description: Test tariff with complex activation rule
activation_rule: serviceOffering.id == 'f3e56622-8cad-475d-92aa-5495b31768fd' && zone.name == 'ref-trl-9690-k-Mol8-kiran-chavala'
removed: NULL
end_date: NULL
position: 1
1 row in set (0.00 sec)
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
CloudStack Quota API Implementation
Summary
This PR implements comprehensive support for CloudStack Quota APIs in the Terraform CloudStack provider, enabling users to manage quota tariffs and monitor quota usage through Terraform.
Features Added
Data Sources
cloudstack_quota- Retrieve quota summary for accounts/domainscloudstack_quota_enabled- Check if quota plugin is enabledcloudstack_quota_tariff- Query existing quota tariffs with filteringResources
cloudstack_quota_tariff- Full CRUD operations for quota tariff managementTechnical Implementation
Core Components
Schema Features
Testing Coverage
Acceptance Tests (11 total)
Manual Testing Scenarios
Documentation
Website Documentation
Examples
Code Quality
Standards Compliance
Dependencies
Use Cases
This implementation enables:
Breaking Changes
None - This is a new feature addition with no impact on existing functionality.
Checklist
Related APIs
Implements CloudStack APIs:
quotaSummaryquotaIsEnabledquotaTariffListquotaTariffCreatequotaTariffUpdatequotaTariffDeleteHow to Test