Closed vgrigoruk closed 3 years ago
Thanks @vgrigoruk, looks like the fix for https://github.com/pactflow/terraform-provider-pact/issues/6 went too far the other way. I'll ensure both cases are considered in a fix, and re-test the import feature.
If it's possible, a simpler approach would be to delete the webhook from your broker for now, and re-apply this way (but I understand the need for an import feature!)
I think I've fixed this in #507d4fb. I'll push out a release shorly.
Fixed in v0.1.5 - I'm going to add some acceptance tests for importing resources as we don't currently have those.
I'm unable to import existing webhooks from
pactflow
broker. Pact broker API returnswebhook
withrequest.body
as aJSON
object, while https://github.com/pactflow/terraform-provider-pact/blob/c6288d6eaf3611a9c7822d3b3b3a32f056febd2a/broker/webhook.go#L15 expects it to be a string (e.g. this is valid in case of XML bodies). That's why unmarshalling fails (see debug output below)Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
As
request.body
could be either a string (e.g. for XML bodies) or JSON object, API client should detect whenrequest.body
is an object and only then convert it to a string.Actual Behavior
API client fails to parse response from pact broker, which makes it impossible to import these resources.
Steps to Reproduce
terraform import pact_webhook.resource_name webhook_id