From 62fe3c84fffa1a5214632d133021d5232da442c7 Mon Sep 17 00:00:00 2001 From: hiranadikari993 Date: Mon, 22 Jan 2024 14:26:40 +0530 Subject: [PATCH] Add AmazonMQ module --- modules/aws/MQ/aws_mq_broker.tf | 36 ++++++++++++++++++ modules/aws/MQ/outputs.tf | 14 +++++++ modules/aws/MQ/variables.tf | 65 +++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 modules/aws/MQ/aws_mq_broker.tf create mode 100644 modules/aws/MQ/outputs.tf create mode 100644 modules/aws/MQ/variables.tf diff --git a/modules/aws/MQ/aws_mq_broker.tf b/modules/aws/MQ/aws_mq_broker.tf new file mode 100644 index 0000000..3b3377b --- /dev/null +++ b/modules/aws/MQ/aws_mq_broker.tf @@ -0,0 +1,36 @@ +# ------------------------------------------------------------------------------------- +# +# Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). All Rights Reserved. +# +# This software is the property of WSO2 LLC. and its suppliers, if any. +# Dissemination of any information or reproduction of any material contained +# herein in any form is strictly forbidden, unless permitted by WSO2 expressly. +# You may not alter or remove any copyright or other notice from copies of this content. +# +# -------------------------------------------------------------------------------------- + +resource "aws_mq_broker" "mq" { + broker_name = join("-", [var.project, var.application, var.environment, var.region, "mq"]) + + engine_type = "ActiveMQ" + engine_version = var.engine_version + host_instance_type = var.instance_type + security_groups = var.security_group_ids + subnet_ids = var.subnet_ids + publicly_accessible = var.public_access + auto_minor_version_upgrade = var.auto_minor_version_upgrade + + dynamic "user" { + for_each = var.users + content { + username = user.value.username + password = user.value.password + console_access = user.value.console_access + } + } + + logs { + audit = var.audit_logs_enabled + general = var.general_logs_enabled + } +} diff --git a/modules/aws/MQ/outputs.tf b/modules/aws/MQ/outputs.tf new file mode 100644 index 0000000..90fd9ac --- /dev/null +++ b/modules/aws/MQ/outputs.tf @@ -0,0 +1,14 @@ +# ------------------------------------------------------------------------------------- +# +# Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). All Rights Reserved. +# +# This software is the property of WSO2 LLC. and its suppliers, if any. +# Dissemination of any information or reproduction of any material contained +# herein in any form is strictly forbidden, unless permitted by WSO2 expressly. +# You may not alter or remove any copyright or other notice from copies of this content. +# +# -------------------------------------------------------------------------------------- + +output "aws_mq_broker_name" { + value = aws_mq_broker.mq.broker_name +} diff --git a/modules/aws/MQ/variables.tf b/modules/aws/MQ/variables.tf new file mode 100644 index 0000000..e6d6ca7 --- /dev/null +++ b/modules/aws/MQ/variables.tf @@ -0,0 +1,65 @@ +# ------------------------------------------------------------------------------------- +# +# Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). All Rights Reserved. +# +# This software is the property of WSO2 LLC. and its suppliers, if any. +# Dissemination of any information or reproduction of any material contained +# herein in any form is strictly forbidden, unless permitted by WSO2 expressly. +# You may not alter or remove any copyright or other notice from copies of this content. +# +# -------------------------------------------------------------------------------------- + +variable "project" { + type = string + description = "Name of the project" +} +variable "environment" { + type = string + description = "Name of the environment" +} +variable "region" { + type = string + description = "Code of the region" +} +variable "application" { + type = string + description = "Purpose of the EKS Cluster" +} +variable "engine_version" { + type = string +} +variable "instance_type" { + type = string +} +variable "security_group_ids" { + type = list(string) + default = null +} +variable "audit_logs_enabled" { + type = bool + default = false +} +variable "general_logs_enabled" { + type = bool + default = false +} +variable "users" { + type = list(object({ + username = string + password = string + console_access = bool + })) + default = [] +} +variable "subnet_ids" { + type = list(string) + default = [] +} +variable "public_access" { + type = bool + default = false +} +variable "auto_minor_version_upgrade" { + type = bool + default = false +}