diff --git a/README.md b/README.md index 54e2340..40cf9d3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,46 @@ -# terraform-solacebroker-queue-endpoint -Solace software broker Terraform module to abstract a broker queue endpoint or an endpoint template configuration +# Solace PubSub+ Software Event Broker Queue Endpoint Terraform Module + +Terraform module to configure a "guaranteed messaging endpoint" or an "endpoint template" on the PubSub+ event broker. Note: "queue endpoint" in the title also refers to all these types as a generic name. + +This module supports the configuration of one of the followings: + +- a "queue" or a "topic endpoint": applications that make use of [Guaranteed Messaging](https://docs.solace.com/Messaging/Guaranteed-Msg/Guaranteed-Messages.htm), need [endpoints](https://docs.solace.com/Messaging/Guaranteed-Msg/Endpoints.htm) configured on the event broker to persist messages. A queue may also have a list of [topic subscriptions](https://docs.solace.com/API/API-Developer-Guide/Adding-Topic-Subscriptio.htm). + +- a "queue template" or a "topic endpoint template": [Endpoint templates](https://docs.solace.com/Messaging/Guaranteed-Msg/Endpoint-Templates.htm?Highlight=Endpoint%20templates) may be used for new client created endpoints. + +The module also supports exposing a created queue or topic endpoint via JNDI for JMS applications. + +## Module variables + +Endpoints and endpoint templates are specific to a Message VPN on the broker, therefore the Message VPN name is a mandatory module input variable. + +Another mandatory input variable is the type of the endpoint or template to be created. Only one type can be created at a time. + +Optional module variables are either shared by multiple types, or conditional to the type where incompatible variables will be ignored. For example, the `permission` variable is shared by all endpoint and template types but `queue_name_filter` is specific to the `queue_template` type and ignored for other types. The recommended approach to determine variable name mappings is to look up the endpoint or template resource's documentation for attribute names. + +Most optional variables' default value is null. If they are not provided then the default for the related resource attribute will be configured on the broker. + +## Examples + +Refer to the following configuration examples: + +- Queue + - Exclusive queue + - Non-exclusive queue + - Partitioned queue + - Queue with topic subscriptions + - Queue with exposed JNDI +- Queue template +- Topic endpoint + - Topic endpoint with exposed JNDI +- Topic endpoint template + +## Module use recommendations + +## Resources + +For more information about Solace technology in general please visit these resources: + +- The Solace Developer Portal website at: [solace.dev](//solace.dev/) +- Understanding [Solace technology](//solace.com/products/platform/) +- Ask the [Solace community](//dev.solace.com/community/). diff --git a/internal/gen-template/main.tf b/internal/gen-template/main.tf index 1813dfd..55d978c 100644 --- a/internal/gen-template/main.tf +++ b/internal/gen-template/main.tf @@ -3,8 +3,8 @@ resource "solacebroker_msg_vpn_queue" "main" { msg_vpn_name = var.msg_vpn_name queue_name = var.endpoint_name - ingress_enabled = true - egress_enabled = true + ingress_enabled = var.ingress_enabled + egress_enabled = var.egress_enabled #AutoAddAttributes #EnableCommonVariables } @@ -30,10 +30,10 @@ resource "solacebroker_msg_vpn_topic_endpoint" "main" { msg_vpn_name = var.msg_vpn_name topic_endpoint_name = var.endpoint_name - ingress_enabled = true - egress_enabled = true + ingress_enabled = var.ingress_enabled + egress_enabled = var.egress_enabled - #AutoAddAttributes #EnableCommonVariables #RenameVariables {"max_spool_usage": "max_msg_spool_usage"} + #AutoAddAttributes #EnableCommonVariables } diff --git a/internal/gen-template/variables.tf b/internal/gen-template/variables.tf index cd2ca98..9c283d1 100644 --- a/internal/gen-template/variables.tf +++ b/internal/gen-template/variables.tf @@ -1,12 +1,12 @@ # Input variable definitions variable "msg_vpn_name" { - description = "Message vpn name" + description = "The name of the Message VPN" type = string } variable "endpoint_type" { - description = "Queue endpoint type. Must be one of `queue`, `topic_endpoint`, `queue_template` or `topic_endpoint_template`." + description = "The endpoint or template type. Must be one of `queue`, `topic_endpoint`, `queue_template` or `topic_endpoint_template`." type = string validation { condition = contains(["queue", "topic_endpoint", "queue_template", "topic_endpoint_template"], var.endpoint_type) @@ -37,4 +37,16 @@ variable "jndi_topic_name" { default = "" } +variable "ingress_enabled" { + description = "Enable or disable the reception of messages to the endpoint. The default value is `true`" + type = bool + default = true +} + +variable "egress_enabled" { + description = "Enable or disable the transmission of messages from the endpoint. The default value is `true`" + type = bool + default = true +} + #AutoAddAttributes \ No newline at end of file diff --git a/main.tf b/main.tf index 19a3564..6f45f43 100644 --- a/main.tf +++ b/main.tf @@ -3,8 +3,8 @@ resource "solacebroker_msg_vpn_queue" "main" { msg_vpn_name = var.msg_vpn_name queue_name = var.endpoint_name - ingress_enabled = true - egress_enabled = true + ingress_enabled = var.ingress_enabled + egress_enabled = var.egress_enabled access_type = var.access_type consumer_ack_propagation_enabled = var.consumer_ack_propagation_enabled @@ -58,8 +58,8 @@ resource "solacebroker_msg_vpn_topic_endpoint" "main" { msg_vpn_name = var.msg_vpn_name topic_endpoint_name = var.endpoint_name - ingress_enabled = true - egress_enabled = true + ingress_enabled = var.ingress_enabled + egress_enabled = var.egress_enabled access_type = var.access_type consumer_ack_propagation_enabled = var.consumer_ack_propagation_enabled @@ -73,7 +73,7 @@ resource "solacebroker_msg_vpn_topic_endpoint" "main" { max_delivered_unacked_msgs_per_flow = var.max_delivered_unacked_msgs_per_flow max_msg_size = var.max_msg_size max_redelivery_count = var.max_redelivery_count - max_spool_usage = var.max_msg_spool_usage + max_spool_usage = var.max_spool_usage max_ttl = var.max_ttl owner = var.owner permission = var.permission diff --git a/variables.tf b/variables.tf index b5451a2..0fca7cc 100644 --- a/variables.tf +++ b/variables.tf @@ -1,12 +1,12 @@ # Input variable definitions variable "msg_vpn_name" { - description = "Message vpn name" + description = "The name of the Message VPN" type = string } variable "endpoint_type" { - description = "Queue endpoint type. Must be one of `queue`, `topic_endpoint`, `queue_template` or `topic_endpoint_template`." + description = "The endpoint or template type. Must be one of `queue`, `topic_endpoint`, `queue_template` or `topic_endpoint_template`." type = string validation { condition = contains(["queue", "topic_endpoint", "queue_template", "topic_endpoint_template"], var.endpoint_type) @@ -37,6 +37,18 @@ variable "jndi_topic_name" { default = "" } +variable "ingress_enabled" { + description = "Enable or disable the reception of messages to the endpoint. The default value is `true`" + type = bool + default = true +} + +variable "egress_enabled" { + description = "Enable or disable the transmission of messages from the endpoint. The default value is `true`" + type = bool + default = true +} + variable "access_type" { description = "The access type for delivering messages to consumer flows bound to the Queue." type = string @@ -147,6 +159,12 @@ variable "max_redelivery_count" { default = null } +variable "max_spool_usage" { + description = "The maximum message spool usage allowed by the Topic Endpoint, in megabytes (MB)." + type = number + default = null +} + variable "max_ttl" { description = "The maximum time in seconds a message can stay in the Queue when `respect_ttl_enabled` is `\"true\"`." type = number