Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWoolfenden committed Jan 17, 2020
1 parent fde5cc6 commit 23e5439
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 32 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@ module "acivemq" {
|------|-------------|:----:|:-----:|:-----:|
| common\_tags | This is to help you add tags to your cloud objects | map | n/a | yes |
| ingress | | list | `<list>` | no |
| logs | | map | `<map>` | no |
| logs | Describes the logs block | map | `<map>` | no |
| maintenance\_window\_start\_time | Describe the Maintenance window block | map | `<map>` | no |
| mq\_broker | | map | `<map>` | no |
| my\_config | | map | `<map>` | no |
| subnet\_ids | | list | n/a | yes |
| vpc\_id | | string | n/a | yes |
| mq\_broker | MQ broker details | map | n/a | yes |
| mq\_username | | string | `"ExampleUser"` | no |
| my\_config | MQ Config | map | n/a | yes |
| subnet\_ids | Contains subnet ids | list | n/a | yes |
| vpc\_id | The VPC id | string | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| broker | |
| configuration | |
| mq\_password | |
| mq\_username | |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

Expand Down
5 changes: 5 additions & 0 deletions aws_mq_broker.broker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ resource "aws_mq_broker" "broker" {
subnet_ids = var.subnet_ids
tags = var.common_tags
}

variable "mq_username" {
type = string
default = "ExampleUser"
}
10 changes: 0 additions & 10 deletions aws_mq_configuration.broker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,3 @@ DATA
tags = var.common_tags

}


variable "my_config" {
default = {
description = "Example Configuration"
name = "example"
engine_type = "ActiveMQ"
engine_version = "5.15.0"
}
}
20 changes: 13 additions & 7 deletions aws_security_group.broker.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
resource "aws_security_group" "broker" {
description = "Managed by Terraform"
egress {
protocol = "tcp"
from_port = 80
to_port = 80

cidr_blocks = ["0.0.0.0/0", ]
description = "Outbound"
from_port = 0
protocol = "-1"
to_port = 0
}

ingress {
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = ["0.0.0.0/0"]
description = "MQ port"
from_port = 61616
protocol = "tcp"
self = false
to_port = 61616
}


name = "Broker"
vpc_id = var.vpc_id
tags = var.common_tags
Expand Down
14 changes: 14 additions & 0 deletions example/examplea/examplea.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
common_tags = {
name = "Pizza"
}

my_config = {
description = "authentic Configuration"
name = "authentic"
engine_type = "ActiveMQ"
engine_version = "5.15.0"
}

mq_broker = {
name = "authentic"
engine_type = "ActiveMQ"
engine_version = "5.15.0"
host_instance_type = "mq.t2.micro"
}
2 changes: 2 additions & 0 deletions example/examplea/module.broker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ module "broker" {
common_tags = var.common_tags
subnet_ids = [element(tolist(data.aws_subnet_ids.private.ids), 0)]
vpc_id = element(tolist(data.aws_vpcs.main.ids), 0)
mq_broker = var.mq_broker
my_config = var.my_config
}
8 changes: 8 additions & 0 deletions example/examplea/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ output "configuration" {
output "broker" {
value = module.broker.broker
}

output "mq_username" {
value = module.broker.mq_username
}

output "mq_password" {
value = module.broker.mq_password
}
4 changes: 4 additions & 0 deletions example/examplea/provider.aws.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ provider "aws" {
region = "us-west-2"
version = "2.42"
}

provider "random" {
version = "2.2"
}
10 changes: 10 additions & 0 deletions example/examplea/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@ variable "sub_public_tag" {
type = string
default = "*public*"
}

variable "mq_broker" {
type = map

}

variable "my_config" {
description = "MQ Config"
type = map
}
8 changes: 8 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ output "configuration" {
output "broker" {
value = aws_mq_broker.broker
}

output "mq_username" {
value = var.mq_username
}

output "mq_password" {
value = random_password.password.result
}
5 changes: 5 additions & 0 deletions password.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "random_password" "password" {
length = 16
special = true
override_special = "_%@"
}
2 changes: 1 addition & 1 deletion validate.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env pwsh
Push-Location
Set-Location example/exampleA
Set-Location example/examplea
Remove-Item .terraform -force -Recurse -ErrorAction SilentlyContinue
terraform init
terraform validate
Expand Down
22 changes: 13 additions & 9 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ variable "common_tags" {
}

variable "mq_broker" {
default = {
name = "example"
engine_type = "ActiveMQ"
engine_version = "5.15.0"
host_instance_type = "mq.t2.micro"
}
type = map
description = "MQ broker details"
}

variable "subnet_ids" {
type = list
description = "Contains subnet ids"
type = list
}

variable "logs" {
type = map
description = "Describes the logs block"
type = map
default = {
general = "true"
audit = "false"
Expand All @@ -36,5 +34,11 @@ variable "maintenance_window_start_time" {


variable "vpc_id" {
type = string
description = "The VPC id"
type = string
}

variable "my_config" {
description = "MQ Config"
type = map
}

0 comments on commit 23e5439

Please sign in to comment.