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

Error while enabling a community plugin #31

Closed tylerohlsen closed 4 years ago

tylerohlsen commented 4 years ago

I'm getting an error when I attempt to install / enable the delayed message exchange plugin.
Version: 1.2.0 (manually compiled from source for Windows)

I'm attempting to install / enable the delayed message exchange plugin with this configuration:

# Enable the delayed message queue plugin
resource "cloudamqp_plugin_community" "rabbitmq_plugin_delayed_message_exchange" {
  instance_id = cloudamqp_instance.rabbitmq.id
  name        = "rabbitmq_delayed_message_exchange"
  enabled     = true
}

When I run terraform apply, I get the following error:

Error: EnablePluginCommunity failed, status: 400, message: map[message:Invalid JSON in request body]

  on modules\rabbitmq\main.tf line 27, in resource "cloudamqp_plugin_community" "rabbitmq_plugin_delayed_message_exchange":
  27: resource "cloudamqp_plugin_community" "rabbitmq_plugin_delayed_message_exchange" {

I can manually install the plugin and import the state into terraform, but when I run terraform apply again, it thinks there's a change:

  # cloudamqp_plugin_community.rabbitmq_plugin_delayed_message_exchange will be updated in-place
  ~ resource "cloudamqp_plugin_community" "rabbitmq_plugin_delayed_message_exchange" {
      + enabled     = true
        id          = "rabbitmq_delayed_message_exchange"
        instance_id = 87639
        name        = "rabbitmq_delayed_message_exchange"
    }

but the plugin is actually enabled on my instance so when I attempt to continue to apply I get the same error again:

Error: UpdatePluginCommunity failed, status: 400, message: map[message:Invalid JSON in request body]

  on modules\rabbitmq\main.tf line 27, in resource "cloudamqp_plugin_community" "rabbitmq_plugin_delayed_message_exchange":
  27: resource "cloudamqp_plugin_community" "rabbitmq_plugin_delayed_message_exchange" {
tbroden84 commented 4 years ago

Our intermediate go-api that wraps CloudAMQP API used the wrong body format and content-type. Pushed a fix for that.

tylerohlsen commented 4 years ago

That fixed it! Thanks for the quick response and fix!