Configuration in this directory demonstrates how to specify request headers when configuring REST messaging on the PubSub+ event broker, leveraging the REST Delivery Terraform module.
There are two types of request header resources:
- "Request headers" - HTTP headers that don't contain sensitive data
- "Protected request headers" - their value contain sensitive data and must be handled accordingly
The REST Delivery module supports a set of "Request headers" and "Protected request headers" to be passed as input variables.
The example shows how to set the sensitive protected_request_headers
variable with a .tfvars
file, as described in the Protect sensitive input variables Terraform tutorial.
msg_vpn_name
- Set todefault
in the example.rest_delivery_point_name
url
- Set tohttps://example.com/test
in the example.queue_name
- Set tordp_queue
, the queue that has been created to be used with the RDP.
Important: The REST delivery point must have permission to consume messages from the queue — to achieve this, the queue’s owner must be set to #rdp/<rest_delivery_point_name>
or the queue’s permissions for non-owner clients must be set to at least consume
level access. Queue ingress and egress must also be enabled.
request_headers
- Provided as a set of objects in the example. Also check the using-substitution-expressions example for additional samples.protected_request_headers
- Provided as a set of objects in the example.
Optional module input variables have the same name as the attributes of the underlying provider resource. If omitted, then the default for the related resource attribute will be configured on the broker. For a list of attributes and the corresponding defaults, see the documentation of "solacebroker_msg_vpn_rest_delivery_point_queue_binding".
The module default for the enabled
variable is true, which enables both the RDP and the REST consumer resources.
The module rdp
, consumer
and queue_binding
outputs refer to the created REST delivery point, REST consumer and queue binding.
This example will create the following resources:
solacebroker_msg_vpn_queue
(created before the module, as pre-requisite)solacebroker_msg_vpn_rest_delivery_point
solacebroker_msg_vpn_rest_delivery_point_rest_consumer
solacebroker_msg_vpn_rest_delivery_point_queue_binding
solacebroker_msg_vpn_rest_delivery_point_queue_binding_request_header
solacebroker_msg_vpn_rest_delivery_point_queue_binding_protected_request_header
If you don't already have access to a broker, see the Developers page for options to get started.
The sample is available from the module GitHub repo:
git clone https://github.com/SolaceProducts/terraform-solacebroker-rest-delivery.git
cd examples/adding-headers
Adjust the provider parameters in main.tf
according to your broker. The example configuration shows settings for a local broker running in Docker.
Tip: You can verify configuration changes on the broker, before and after, using the PubSub+ Broker Manager Web UI.
Execute from this folder:
terraform init
terraform plan -var-file="secret.tfvars"
terraform apply -var-file="secret.tfvars"
Run terraform destroy
to clean up the created resources when they are no longer needed.
For more information, see Managing REST Delivery Points section in the PubSub+ documentation.