Skip to content

Commit 5000586

Browse files
edson.siqueira@dnx.solutionsedson.siqueira@dnx.solutions
edson.siqueira@dnx.solutions
authored and
edson.siqueira@dnx.solutions
committed
Creating SSM to Endpoint and Port, add variable secret_method
1 parent 833b33b commit 5000586

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ssm.tf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
resource "aws_ssm_parameter" "redis_endpoint" {
2+
count = var.secret_method == "ssm" ? 1 : 0
3+
name = "/elasticache/redis/${var.environment_name}-${var.name}/ENDPOINT"
4+
description = "Elasticache Redis Endpoint"
5+
type = "String"
6+
value = aws_elasticache_replication_group.redis[0].primary_endpoint_address
7+
}
8+
9+
resource "aws_ssm_parameter" "redis_port" {
10+
count = var.secret_method == "ssm" ? 1 : 0
11+
name = "/elasticache/redis/${var.environment_name}-${var.name}/PORT"
12+
description = "Elasticache Redis Port"
13+
type = "String"
14+
value = aws_elasticache_replication_group.redis[0].port
15+
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,9 @@ variable "notification_topic_arn" {
170170
type = string
171171
default = ""
172172
}
173+
174+
variable "secret_method" {
175+
description = "Use ssm for SSM parameters store which is the default option, or secretsmanager for AWS Secrets Manager"
176+
type = string
177+
default = "ssm"
178+
}

0 commit comments

Comments
 (0)