Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variables so we can add custom names for ssm parameters #34

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ Available targets:
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Whether to create a default Security Group with unique name beginning with the normalized prefix. | `bool` | `false` | no |
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | A list of Security Group IDs to associate with AmazonMQ. | `list(string)` | `[]` | no |
| <a name="input_ssm_parameter_name_format"></a> [ssm\_parameter\_name\_format](#input\_ssm\_parameter\_name\_format) | SSM parameter name format | `string` | `"/%s/%s"` | no |
| <a name="input_ssm_parameter_name_password"></a> [ssm\_parameter\_name\_password](#input\_ssm\_parameter\_name\_password) | SSM parameter name for admin password | `string` | `"mq_admin_password"` | no |
| <a name="input_ssm_parameter_name_username"></a> [ssm\_parameter\_name\_username](#input\_ssm\_parameter\_name\_username) | SSM parameter name for admin username | `string` | `"mq_admin_username"` | no |
| <a name="input_ssm_path"></a> [ssm\_path](#input\_ssm\_path) | SSM path | `string` | `"mq"` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of VPC subnet IDs | `list(string)` | n/a | yes |
Expand Down
2 changes: 2 additions & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Whether to create a default Security Group with unique name beginning with the normalized prefix. | `bool` | `false` | no |
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | A list of Security Group IDs to associate with AmazonMQ. | `list(string)` | `[]` | no |
| <a name="input_ssm_parameter_name_format"></a> [ssm\_parameter\_name\_format](#input\_ssm\_parameter\_name\_format) | SSM parameter name format | `string` | `"/%s/%s"` | no |
| <a name="input_ssm_parameter_name_password"></a> [ssm\_parameter\_name\_password](#input\_ssm\_parameter\_name\_password) | SSM parameter name for admin password | `string` | `"mq_admin_password"` | no |
| <a name="input_ssm_parameter_name_username"></a> [ssm\_parameter\_name\_username](#input\_ssm\_parameter\_name\_username) | SSM parameter name for admin username | `string` | `"mq_admin_username"` | no |
| <a name="input_ssm_path"></a> [ssm\_path](#input\_ssm\_path) | SSM path | `string` | `"mq"` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of VPC subnet IDs | `list(string)` | n/a | yes |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "random_password" "mq_application_password" {

resource "aws_ssm_parameter" "mq_master_username" {
count = local.enabled && local.mq_admin_user_enabled ? 1 : 0
name = format(var.ssm_parameter_name_format, var.ssm_path, "mq_admin_username")
name = format(var.ssm_parameter_name_format, var.ssm_path, var.ssm_parameter_name_username)
value = local.mq_admin_user
description = "MQ Username for the admin user"
type = "String"
Expand All @@ -56,7 +56,7 @@ resource "aws_ssm_parameter" "mq_master_username" {

resource "aws_ssm_parameter" "mq_master_password" {
count = local.enabled && local.mq_admin_user_enabled ? 1 : 0
name = format(var.ssm_parameter_name_format, var.ssm_path, "mq_admin_password")
name = format(var.ssm_parameter_name_format, var.ssm_path, var.ssm_parameter_name_password)
value = local.mq_admin_password
description = "MQ Password for the admin user"
type = "SecureString"
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ variable "ssm_parameter_name_format" {
description = "SSM parameter name format"
}

variable "ssm_parameter_name_username" {
type = string
default = "mq_admin_username"
description = "SSM parameter name for admin username"
}

variable "ssm_parameter_name_password" {
type = string
default = "mq_admin_password"
description = "SSM parameter name for admin password"
}

variable "ssm_path" {
type = string
default = "mq"
Expand Down