Skip to content

Commit

Permalink
Merge pull request #118 from yunkon-kim/241128-17
Browse files Browse the repository at this point in the history
Add AWS MQ (ActiveMQ) example
  • Loading branch information
yunkon-kim authored Nov 28, 2024
2 parents 11ea339 + a62e5e7 commit edb7bec
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 42 deletions.
87 changes: 87 additions & 0 deletions examples/aws/mq-broker/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Define the required version of Terraform and the providers that will be used in the project
terraform {
# Required Tofu version
required_version = "~>1.8.3"

required_providers {
# AWS provider is specified with its source and version
aws = {
source = "registry.opentofu.org/hashicorp/aws"
version = "~>5.42"
}
}
}

# Provider block for AWS specifies the configuration for the provider
provider "aws" {
region = "ap-northeast-2"
}


# Define the VPC resource block
resource "aws_vpc" "tofu_example" {
cidr_block = "192.168.64.0/22"

tags = {
Name = "tofu-101"
}
}

# Amazon MQ Broker (ActiveMQ)
resource "aws_mq_broker" "tofu_example" {
broker_name = "tofu-broker"
engine_type = "ActiveMQ" # RabbitMQ is also available
engine_version = "5.17.6" # Valid values: [5.18, 5.17.6, 5.16.7]
# auto_minor_version_upgrade = true # Brokers on [ActiveMQ] version [5.18] must have [autoMinorVersionUpgrade] set to [true]
host_instance_type = "mq.t3.micro"
publicly_accessible = true

user {
username = "admin"
password = "examplepassword"
}
}

# Security Group for Amazon MQ
resource "aws_security_group" "mq_sg" {
name_prefix = "tofu-mq-sg-"
description = "MQ Broker Security Group"
vpc_id = aws_vpc.tofu_example.id

ingress {
from_port = 5671
to_port = 5671
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

# Output Broker Information
output "amazon_mq_broker_info" {
value = {
broker_id = aws_mq_broker.tofu_example.id
broker_endpoint = aws_mq_broker.tofu_example.instances[0].endpoints[0]
security_group = aws_security_group.mq_sg.id
}
}

output "all_vpc_info" {
value = aws_vpc.tofu_example
}


output "all_security_group_info" {
value = aws_security_group.mq_sg
}

output "all_mq_broker_info" {
value = aws_mq_broker.tofu_example
sensitive = true
}
84 changes: 42 additions & 42 deletions templates/vpn/gcp-aws/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,38 +96,38 @@ output "vpn_info" {
aws = {
vpn_gateway = {
resource_type = "aws_vpn_gateway"
name = aws_vpn_gateway.vpn_gw.tags.Name
id = aws_vpn_gateway.vpn_gw.id
vpc_id = aws_vpn_gateway.vpn_gw.vpc_id
name = aws_vpn_gateway.vpn_gw.tags.Name
id = aws_vpn_gateway.vpn_gw.id
vpc_id = aws_vpn_gateway.vpn_gw.vpc_id
}
customer_gateways = [
{
resource_type = "aws_customer_gateway"
name = aws_customer_gateway.cgw_1.tags.Name
id = aws_customer_gateway.cgw_1.id
ip_address = aws_customer_gateway.cgw_1.ip_address
bgp_asn = aws_customer_gateway.cgw_1.bgp_asn
name = aws_customer_gateway.cgw_1.tags.Name
id = aws_customer_gateway.cgw_1.id
ip_address = aws_customer_gateway.cgw_1.ip_address
bgp_asn = aws_customer_gateway.cgw_1.bgp_asn
},
{
resource_type = "aws_customer_gateway"
name = aws_customer_gateway.cgw_2.tags.Name
id = aws_customer_gateway.cgw_2.id
ip_address = aws_customer_gateway.cgw_2.ip_address
bgp_asn = aws_customer_gateway.cgw_2.bgp_asn
name = aws_customer_gateway.cgw_2.tags.Name
id = aws_customer_gateway.cgw_2.id
ip_address = aws_customer_gateway.cgw_2.ip_address
bgp_asn = aws_customer_gateway.cgw_2.bgp_asn
}
]
vpn_connections = [
{
resource_type = "aws_vpn_connection"
name = aws_vpn_connection.vpn_cnx_1.tags.Name
id = aws_vpn_connection.vpn_cnx_1.id
resource_type = "aws_vpn_connection"
name = aws_vpn_connection.vpn_cnx_1.tags.Name
id = aws_vpn_connection.vpn_cnx_1.id
tunnel1_address = aws_vpn_connection.vpn_cnx_1.tunnel1_address
tunnel2_address = aws_vpn_connection.vpn_cnx_1.tunnel2_address
},
{
resource_type = "aws_vpn_connection"
name = aws_vpn_connection.vpn_cnx_2.tags.Name
id = aws_vpn_connection.vpn_cnx_2.id
resource_type = "aws_vpn_connection"
name = aws_vpn_connection.vpn_cnx_2.tags.Name
id = aws_vpn_connection.vpn_cnx_2.id
tunnel1_address = aws_vpn_connection.vpn_cnx_2.tunnel1_address
tunnel2_address = aws_vpn_connection.vpn_cnx_2.tunnel2_address
}
Expand All @@ -136,48 +136,48 @@ output "vpn_info" {
gcp = {
router = {
resource_type = "google_compute_router"
name = google_compute_router.router_1.name
id = google_compute_router.router_1.id
network = google_compute_router.router_1.network
bgp_asn = google_compute_router.router_1.bgp[0].asn
name = google_compute_router.router_1.name
id = google_compute_router.router_1.id
network = google_compute_router.router_1.network
bgp_asn = google_compute_router.router_1.bgp[0].asn
}
ha_vpn_gateway = {
resource_type = "google_compute_ha_vpn_gateway"
name = google_compute_ha_vpn_gateway.ha_vpn_gw_1.name
id = google_compute_ha_vpn_gateway.ha_vpn_gw_1.id
network = google_compute_ha_vpn_gateway.ha_vpn_gw_1.network
ip_addresses = google_compute_ha_vpn_gateway.ha_vpn_gw_1.vpn_interfaces[*].ip_address
name = google_compute_ha_vpn_gateway.ha_vpn_gw_1.name
id = google_compute_ha_vpn_gateway.ha_vpn_gw_1.id
network = google_compute_ha_vpn_gateway.ha_vpn_gw_1.network
ip_addresses = google_compute_ha_vpn_gateway.ha_vpn_gw_1.vpn_interfaces[*].ip_address
}
vpn_tunnels = [
{
resource_type = "google_compute_vpn_tunnel"
name = google_compute_vpn_tunnel.vpn_tunnel_1.name
id = google_compute_vpn_tunnel.vpn_tunnel_1.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_1.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_1.vpn_gateway_interface
name = google_compute_vpn_tunnel.vpn_tunnel_1.name
id = google_compute_vpn_tunnel.vpn_tunnel_1.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_1.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_1.vpn_gateway_interface
},
{
resource_type = "google_compute_vpn_tunnel"
name = google_compute_vpn_tunnel.vpn_tunnel_2.name
id = google_compute_vpn_tunnel.vpn_tunnel_2.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_2.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_2.vpn_gateway_interface
name = google_compute_vpn_tunnel.vpn_tunnel_2.name
id = google_compute_vpn_tunnel.vpn_tunnel_2.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_2.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_2.vpn_gateway_interface
},
{
resource_type = "google_compute_vpn_tunnel"
name = google_compute_vpn_tunnel.vpn_tunnel_3.name
id = google_compute_vpn_tunnel.vpn_tunnel_3.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_3.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_3.vpn_gateway_interface
name = google_compute_vpn_tunnel.vpn_tunnel_3.name
id = google_compute_vpn_tunnel.vpn_tunnel_3.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_3.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_3.vpn_gateway_interface
},
{
resource_type = "google_compute_vpn_tunnel"
name = google_compute_vpn_tunnel.vpn_tunnel_4.name
id = google_compute_vpn_tunnel.vpn_tunnel_4.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_4.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_4.vpn_gateway_interface
name = google_compute_vpn_tunnel.vpn_tunnel_4.name
id = google_compute_vpn_tunnel.vpn_tunnel_4.id
ike_version = google_compute_vpn_tunnel.vpn_tunnel_4.ike_version
interface = google_compute_vpn_tunnel.vpn_tunnel_4.vpn_gateway_interface
}
]
}
}
}
}

0 comments on commit edb7bec

Please sign in to comment.