on2itsecurity / terraform-provider-auxo

Terraform provider for AUXO
MIT License
3 stars 1 forks source link

Adding measures with attributes partly set fails #12

Closed RobM83 closed 1 year ago

RobM83 commented 1 year ago

The following will fail.

resource "auxo_measure" "ps_test_measures" {
    protectsurface = auxo_protectsurface.ps_test.id
    measures = {
        data-phishing = {
            assigned = false
            assigned_by = data.auxo_contact.rob.email
        }
    }
}
Error: Error creating protectsurface
│
│   with auxo_measure.ps_test_measures,
│   on testtf.tf line 2102, in resource "auxo_measure" "ps_test_measures":
│ 2102: resource "auxo_measure" "ps_test_measures" {
│
│ unexpected error: Not 200 or 201 ok, but 400, with body {"error_id":"400","error_name":"BadRequestException: missing measure person id","error_message":"BadRequestException: missing measure person id"}

When all attributes are there, it will succeed.

resource "auxo_measure" "ps_test_measures" {
    protectsurface = auxo_protectsurface.ps_test.id
    measures = {
        data-phishing = {
            assigned = false
            assigned_by = data.auxo_contact.rob.email
            implemented = true
            implemented_by = data.auxo_contact.rob.email
            evidenced = true
            evidenced_by = data.auxo_contact.rob.email              
        }
    }
}
RobM83 commented 1 year ago

This was caused by always setting the attributes with an empty value, while it should be nil. Will be fixed in v1.0.2.