A Broker whose Maintenance Is Not an Outage
deployment_mode defaults to SINGLE_INSTANCE, and Amazon MQ reboots the instance to patch it - so a single broker has planned downtime on AWS's schedule. Active/standby across two AZs, both log streams on, and passwords in a separate variable from users, because a sensitive value cannot be a for_each argument at all.
Verification
Static-verifiedPassed: validated and lint-clean (provider-schema-validated for AWS/Azure/GCP; Terraform-language lint elsewhere).
Conformance
- Static validation (fmt · validate · tflint)
- Security scan clean (Checkov)
- Plan tests (mocked: validation rules · outputs)
Provenance
- SHA-256 checksum
- Signature (pending)
Functional
- Live test pending (no cloud run yet)
Last verified 2026-09-13 · how we verify
Use it from the registry
terraform · opentofumodule "mq" {
source = "www.iac-bazaar.com/iac-bazaar/aws-mq/aws"
version = "1.0.0"
}Needs a registry token from /account/tokens. The module itself is free; the account is what identifies you. Full setup: registry docs.
Inputs & outputs
Create a free account to read this module's contract
The declared contract - every input name, type, default and description, plus every output - is shown to signed-in accounts, not to anonymous visitors.
A free account sees the contract of every module in the catalogue. There is no subscription and nothing to buy - the modules are free to download, and they run under Vizier.
Documentation
aws-mq
An Amazon MQ broker that survives losing an availability zone, records who
connected to it, and does not put your message bus on the internet. Works with
Terraform and OpenTofu (>= 1.6), AWS provider >= 6.0, < 7.0.
deployment_mode defaults to SINGLE_INSTANCE, and that is not only a
durability question. Amazon MQ reboots the instance to apply maintenance, so
a single-instance broker has planned downtime on AWS's schedule and every
producer and consumer has to survive it. Active/standby across two AZs here,
with survives_losing_an_az as an output.
Both log streams are off by default. The general log is the broker's own record; the audit log is who connected and what they did through the management interface. Off means an unexplained message loss has nothing to look at.
Passwords are a separate variable from users, and that is not tidiness. The
user block's password is sensitive, and Terraform refuses a sensitive
value as a for_each argument - so one map holding both users and passwords
cannot be iterated at all. users carries the plain facts and is what gets
iterated; user_passwords is sensitive and is looked up by the same key. Both
end up in state, so the state backend needs to be encrypted regardless.
The audit log, console access, multi-user creation and the multi-AZ value are
all engine-specific. RabbitMQ has no audit log, ignores console_access,
accepts exactly one user at creation, and uses CLUSTER_MULTI_AZ rather than
ACTIVE_STANDBY_MULTI_AZ. The API accepts several of those mismatches and then
does nothing with them, so preconditions refuse the combination and name the
value to set instead. The defaults are ActiveMQ, because that is the engine
where every one of those settings exists.
Smaller things: auto_minor_version_upgrade is on, because minor versions are
where the broker's security patches ship; a precondition refuses
publicly_accessible unless accept_public_broker says it was meant; and
kms_key_arn and use_aws_owned_key are mutually exclusive at the API, so
passing a key is what turns the AWS-owned key off.
Verification
Static validation runs tofu fmt, init, validate, tflint and checkov.
This module has not yet had a live test, so it is published as statically
validated with its live test pending and does not carry the live-tested mark.
Usage code & full reference need an account
The complete copy-paste usage, the full input/output reference, and operational notes are free with an account - shown here and bundled in the download. Sign in and this section fills in.
- Usage
Related modules
aws-kinesis-firehose
Without error_output_prefix, records Firehose could not process are written into the same prefix as the ones it could, wrapped in an error envelope that whatever reads the prefix treats as data. Nothing reports it.
aws-eventbridge
A custom EventBridge event bus, a pattern-filtered rule, and a target wired end-to-end - encryption at rest always on, least-privilege log delivery, and a 24h retry policy with optional DLQ.
aws-kinesis
A Kinesis Data Stream with KMS encryption at rest on by default and ON_DEMAND capacity (no shard math), plus optional enhanced fan-out consumers and IAM-only access.
aws-msk
An MSK Serverless Apache Kafka cluster with no brokers to size - SASL/IAM authentication only, encryption in transit and at rest always on, multi-AZ placement, and a locked-down security group.
aws-ses
An SES v2 sending stack - a configuration set with an optional domain/email identity (Easy DKIM) - with TLS required, bounce/complaint suppression, and reputation metrics to CloudWatch.
aws-sns
SNS standard/FIFO topic with encryption, delivery policies, and SQS/Lambda/email subscriptions.