Skip to content

Commit e37b5e1

Browse files
authored
Merge pull request #6 from yaradigitallabs/add-tags-to-non-tag-resources
chore: adding tags to resources without tags to adhere to scp policy
2 parents 2937952 + 081d6e4 commit e37b5e1

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

main.tf

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ resource "random_id" "salt" {
77
}
88

99
resource "aws_elasticache_replication_group" "redis" {
10-
replication_group_id = format("${var.format_length}", "${var.name}-${var.env}")
11-
description = "Terraform-managed ElastiCache replication group for ${var.name}-${var.env}"
12-
num_cache_clusters = var.redis_clusters
13-
node_type = var.redis_node_type
14-
automatic_failover_enabled = var.redis_failover
15-
engine_version = var.redis_version
16-
port = var.redis_port
17-
parameter_group_name = aws_elasticache_parameter_group.redis_parameter_group.id
18-
subnet_group_name = aws_elasticache_subnet_group.redis_subnet_group.id
19-
security_group_ids = compact([aws_security_group.redis_security_group.id, var.enable_vpn_sg ? var.vpn_sg_id : ""])
20-
apply_immediately = var.apply_immediately
21-
maintenance_window = var.redis_maintenance_window
22-
snapshot_window = var.redis_snapshot_window
23-
snapshot_retention_limit = var.redis_snapshot_retention_limit
24-
tags = merge({ "Name" = format("tf-elasticache-%s", var.name) },var.tags)
25-
transit_encryption_enabled = var.transit_encryption_enabled
26-
auth_token = var.transit_encryption_enabled ? var.auth_token : null
10+
replication_group_id = format("${var.format_length}", "${var.name}-${var.env}")
11+
description = "Terraform-managed ElastiCache replication group for ${var.name}-${var.env}"
12+
num_cache_clusters = var.redis_clusters
13+
node_type = var.redis_node_type
14+
automatic_failover_enabled = var.redis_failover
15+
engine_version = var.redis_version
16+
port = var.redis_port
17+
parameter_group_name = aws_elasticache_parameter_group.redis_parameter_group.id
18+
subnet_group_name = aws_elasticache_subnet_group.redis_subnet_group.id
19+
security_group_ids = compact([aws_security_group.redis_security_group.id, var.enable_vpn_sg ? var.vpn_sg_id : ""])
20+
apply_immediately = var.apply_immediately
21+
maintenance_window = var.redis_maintenance_window
22+
snapshot_window = var.redis_snapshot_window
23+
snapshot_retention_limit = var.redis_snapshot_retention_limit
24+
tags = merge({ "Name" = format("tf-elasticache-%s", var.name) }, var.tags)
25+
transit_encryption_enabled = var.transit_encryption_enabled
26+
auth_token = var.transit_encryption_enabled ? var.auth_token : null
2727
}
2828

2929
resource "aws_elasticache_parameter_group" "redis_parameter_group" {
@@ -44,9 +44,11 @@ resource "aws_elasticache_parameter_group" "redis_parameter_group" {
4444
lifecycle {
4545
create_before_destroy = true
4646
}
47+
tags = merge({ "Name" = format("tf-elasticache-%s", var.name) }, var.tags)
4748
}
4849

4950
resource "aws_elasticache_subnet_group" "redis_subnet_group" {
5051
name = replace(format("%.255s", lower(replace("tf-redis-${var.name}-${var.env}", "_", "-"))), "/\\s/", "-")
5152
subnet_ids = var.subnets
53+
tags = merge({ "Name" = format("tf-elasticache-%s", var.name) }, var.tags)
5254
}

0 commit comments

Comments
 (0)