AxtonGrams / terraform-provider-wiz

Terraform provider for managing Wiz resources
Mozilla Public License 2.0
25 stars 18 forks source link

Unable to manage wiz_control_associations (changing cspm controls is not allowed) #34

Open gramsa49 opened 1 year ago

gramsa49 commented 1 year ago

Terraform Version and Provider Version

Terraform v1.3.3 terraform-provider-wiz v1.0.7

Affected Resource(s)

Terraform Configuration Files

Use any Wiz managed control with a custom security sub-category.

Debug Output

{
  "data": {
    "updateControls": {
      "successCount": 0,
      "failCount": 1,
      "errors": [
        {
          "reason": "changing cspm controls is not allowed",
          "control": {
            "id": "014e7d8a-1c95-5220-9852-ffbbcd438f55"
          }
        }
      ]
    }
  }
}

Expected Behavior

Should be able to both define and destroy security sub-category/control associations.

Actual Behavior

Error returned

Community Note

cvirtucio commented 1 year ago

something seems to be clobbering control_ids during the Delete() phase that happens when the control association is getting recreated. this comes up empty, so you only get the securitySubCategoriesToRemove in the UpdateControlsInput struct when the request goes out to Wiz's API.

cvirtucio commented 1 year ago

this fix worked for us: https://github.com/AxtonGrams/terraform-provider-wiz/pull/163