ianc769 opened a new pull request, #197:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/197

   Adding limits as a terraform managed resource option -> 
https://cloudstack.apache.org/api/apidocs-4.20/apis/updateResourceLimit.html
   
   Contributes to #82
   
   Using this code for example:
   
   ```hcl
   resource "random_uuid" "example" {
   }
   
   resource "cloudstack_domain" "example" {
     name             = "example-domain"
     network_domain   = "example.local"
     domain_id        = random_uuid.example.result
     parent_domain_id = "65c9befb-1a1c-11f0-85c0-460f7764ea25"
   }
   
   # Set limit in a domain
   resource "cloudstack_limits" "cpu_limit" {
     type       = "cpu"
     max        = 42
     domainid   = random_uuid.example.result
     depends_on = [cloudstack_domain.example]
   
   }
   
   # Set volume limit for a specific account in a domain
   resource "cloudstack_limits" "volume_limit" {
     type     = "volume"
     max      = 22
     account  = "limits.test"
     domainid = "861bf423-e531-48dc-9bdc-a3183ae0fb0f"
   }
   
   # Set primary storage limit for a project
   resource "cloudstack_limits" "storage_limit" {
     type      = "primarystorage"
     max       = 1423                                   # GB
     projectid = "c3638a06-9598-4c34-8f89-891beda43eca" // Example project ID
   }
   ```
   
   ```bash
   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_domain.example will be created
     + resource "cloudstack_domain" "example" {
         + domain_id        = (known after apply)
         + id               = (known after apply)
         + name             = "example-domain"
         + network_domain   = "example.local"
         + parent_domain_id = "65c9befb-1a1c-11f0-85c0-460f7764ea25"
       }
   
     # cloudstack_limits.cpu_limit will be created
     + resource "cloudstack_limits" "cpu_limit" {
         + domainid = (known after apply)
         + id       = (known after apply)
         + max      = 42
         + type     = "cpu"
       }
   
     # cloudstack_limits.storage_limit will be created
     + resource "cloudstack_limits" "storage_limit" {
         + id        = (known after apply)
         + max       = 1423
         + projectid = "c3638a06-9598-4c34-8f89-891beda43eca"
         + type      = "primarystorage"
       }
   
     # cloudstack_limits.volume_limit will be created
     + resource "cloudstack_limits" "volume_limit" {
         + account  = "limits.test"
         + domainid = "861bf423-e531-48dc-9bdc-a3183ae0fb0f"
         + id       = (known after apply)
         + max      = 22
         + type     = "volume"
       }
   
     # random_uuid.example will be created
     + resource "random_uuid" "example" {
         + id     = (known after apply)
         + result = (known after apply)
       }
   
   Plan: 5 to add, 0 to change, 0 to destroy.
   
   ```
   ```bash
   random_uuid.example: Creating...
   random_uuid.example: Creation complete after 0s 
[id=3e435b24-880a-6bae-50a6-fbd5c9be402b]
   cloudstack_limits.volume_limit: Creating...
   cloudstack_limits.storage_limit: Creating...
   cloudstack_domain.example: Creating...
   cloudstack_domain.example: Creation complete after 0s 
[id=3e435b24-880a-6bae-50a6-fbd5c9be402b]
   cloudstack_limits.volume_limit: Creation complete after 0s 
[id=2-account-limits.test-861bf423-e531-48dc-9bdc-a3183ae0fb0f]
   cloudstack_limits.cpu_limit: Creating...
   cloudstack_limits.storage_limit: Creation complete after 0s 
[id=10-project-c3638a06-9598-4c34-8f89-891beda43eca]
   cloudstack_limits.cpu_limit: Creation complete after 0s 
[id=8-domain-3e435b24-880a-6bae-50a6-fbd5c9be402b]
   
   Apply complete! Resources: 5 added, 0 changed, 0 destroyed.
   ```
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to