cloudamqp / terraform-provider-cloudamqp

Terraform Provider for CloudAMQP
https://registry.terraform.io/providers/cloudamqp/cloudamqp
Mozilla Public License 2.0
35 stars 39 forks source link

Add required field message_type #43

Closed mantoine96 closed 4 years ago

mantoine96 commented 4 years ago

Hello,

Since upgrading to the latest version of the provider (because of the API changes), we've been hitting this error with some cloudamqp_alarm alarms:

[2020-03-04T11:27:09.965Z] Error: Alarms::UpdateAlarm failed, status: 400, message: map[errors:[map[message_type:Field is required]]]

[2020-03-04T11:27:09.965Z] 

[2020-03-04T11:27:09.965Z]   on .terraform/modules/eng-hermes-pesa-cloudamqp/modules/jumo-cloudamqp-cluster/main.tf line 63, in resource "cloudamqp_alarm" "queue_alarms":

[2020-03-04T11:27:09.965Z]   63: resource "cloudamqp_alarm" "queue_alarms" {

Here is a rough definition of the alarm we were creating:

resource "cloudamqp_alarm" "my_alarm" {
  instance_id     = cloudamqp_instance.rmq_bunny.id
  type            = "queue"
  value_threshold = 120
  time_threshold  = 120
  enabled         = true
  queue_regex     = ".*"
  vhost_regex     = ".*"
  recipients      = [cloudamqp_notification.myrecipient.id]
}

In this PR, I added the message_type field to the schema, as well as a validation function for this field, so as to respect the constraints described in the documentation: https://docs.cloudamqp.com/cloudamqp_api.html#alarms

Please also note that the Terraform provider documentation needs to be updated: https://docs.cloudamqp.com/cloudamqp_terraform.html#resource I wasn't able to find a file where this document is generated from, so I assume you create it on your side.

Please let me know if anything is missing,

Cheers

Matthieu

tbroden84 commented 4 years ago

Hi Matthieu, My bad, missed to add this when doing the updates. Thanks for the notice and contribution. Will merge in your PR. Cheers.

mantoine96 commented 4 years ago

@tbroden84 Thank you for merging. I noticed you fixed a mistake I made, so thank you for that as well.

Do you know when you expect to release the change? This is currently blocking some of my internal customers for a product launch.

Thank you!

Matthieu

tbroden84 commented 4 years ago

@thehunt33r Planned to make a release next week together with other updates. But went on and made a smaller release now instead. You would find the new release 1.4.1 available.

mantoine96 commented 4 years ago

Thank you!