cloudstack-terraform-provider icon indicating copy to clipboard operation
cloudstack-terraform-provider copied to clipboard

feat: Update `resource_cloudstack_security_group` to allow `domainid` or `projectid`

Open ianc769 opened this issue 1 month ago • 0 comments

Update resource_cloudstack_security_group to allow domainid or projectid

https://cloudstack.apache.org/api/apidocs-4.21/apis/createSecurityGroup.html

This is breaking since I'm renaming project to projectid (just more descriptive as to what is expected in this field and matches the actual api call)

With the code:

data "cloudstack_domain" "root" {
  filter {
    name  = "name"
    value = "ROOT"
  }
}

resource "cloudstack_security_group" "foo" {
  name        = "terraform-security-group-account"
  description = "terraform-security-group-account-text"
  account     = "admin"
  domainid    = "ROOT"
}

resource "cloudstack_security_group" "foo2" {
  name        = "terraform-security-group-project"
  description = "terraform-security-group-project-text"
  projectid   = "fdaa5a01-bc8c-4e50-a0ea-9135a1c54fb3"
}
12:15:41.534 STDOUT terraform: Terraform used the selected providers to generate the following execution
12:15:41.534 STDOUT terraform: plan. Resource actions are indicated with the following symbols:
12:15:41.535 STDOUT terraform:   + create
12:15:41.535 STDOUT terraform:   ~ update in-place
12:15:41.535 STDOUT terraform: Terraform will perform the following actions:
12:15:41.535 STDOUT terraform:   # cloudstack_security_group.foo will be created
12:15:41.535 STDOUT terraform:   + resource "cloudstack_security_group" "foo" {
12:15:41.535 STDOUT terraform:       + account     = "admin"
12:15:41.535 STDOUT terraform:       + description = "terraform-security-group-account-text"
12:15:41.535 STDOUT terraform:       + domainid    = "03ff694f-a2d5-11f0-95ca-52540047021e"
12:15:41.535 STDOUT terraform:       + id          = (known after apply)
12:15:41.535 STDOUT terraform:       + name        = "terraform-security-group-account"
12:15:41.535 STDOUT terraform:       + projectid   = (known after apply)
12:15:41.535 STDOUT terraform:     }
12:15:41.535 STDOUT terraform:   # cloudstack_security_group.foo2 will be created
12:15:41.535 STDOUT terraform:   + resource "cloudstack_security_group" "foo2" {
12:15:41.535 STDOUT terraform:       + description = "terraform-security-group-project-text"
12:15:41.535 STDOUT terraform:       + domainid    = (known after apply)
12:15:41.535 STDOUT terraform:       + id          = (known after apply)
12:15:41.535 STDOUT terraform:       + name        = "terraform-security-group-project"
12:15:41.535 STDOUT terraform:       + projectid   = "fdaa5a01-bc8c-4e50-a0ea-9135a1c54fb3"
12:15:41.535 STDOUT terraform:     }

12:15:57.912 STDOUT terraform: Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

ianc769 avatar Nov 06 '25 18:11 ianc769