Skip to content
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

conformity_report_config: Cannot set risk_levels filter #24

Open
jbrmg opened this issue Jun 7, 2022 · 1 comment
Open

conformity_report_config: Cannot set risk_levels filter #24

jbrmg opened this issue Jun 7, 2022 · 1 comment

Comments

@jbrmg
Copy link
Contributor

jbrmg commented Jun 7, 2022

Hi,

the risk_levels filter on the conformity_report_config cannot be set successfully as the Terraform provider uses type string but the backend requires an array.

Example:

resource "conformity_report_config" "test" {
  account_id = conformity_azure_account.test.id

  configuration {
    emails     = ["[email protected]"]
    frequency  = "* * *"
    scheduled  = true
    send_email = true
    title      = "Security Report for ${conformity_azure_account.test.name}"
    tz         = "Europe/Berlin"
  }
  filter {
    categories  = ["security"]
    risk_levels = "EXTREME"
  }
}

Error response from backend:

{"errors":[{"source":{"pointer":"/data/attributes/configuration/filter/riskLevels"},"status":422,"detail":"Configuration filter riskLevels should be array"}]}

Ideally, the Terraform provided would support array instead of string so that multiple risk_levels can be provided for any given filter.

@jbrmg
Copy link
Contributor Author

jbrmg commented Jun 28, 2022

Please note that this issue has not been resolved with 0.4.3 as the supposed bugfix was incomplete.

payload.Data.Attributes.Configuration.Filter.RiskLevels = f["risk_levels"].(string)

needs to be changed to

payload.Data.Attributes.Configuration.Filter.RiskLevels = expandStringList(f["risk_levels"].(*schema.Set).List())

and

RiskLevels string `json:"riskLevels,omitempty"`

needs to be changed to

RiskLevels                 []string `json:"riskLevels,omitempty"`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant