From 8339344712e06f2de200eb6fb87cc2e3eb80e4c7 Mon Sep 17 00:00:00 2001 From: cduhn17 Date: Thu, 18 Jul 2024 10:50:18 -0500 Subject: [PATCH 1/2] Update elasticache terraform to add IAM policy related to elasticache --- infrastructure/elasticache.tf | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/infrastructure/elasticache.tf b/infrastructure/elasticache.tf index b5553912..3884b0c4 100644 --- a/infrastructure/elasticache.tf +++ b/infrastructure/elasticache.tf @@ -37,3 +37,28 @@ resource "aws_elasticache_cluster" "crossfeed_vpc_elasticache_cluster" { Stage = var.stage } } + +resource "aws_iam_policy" "elasticache_policy" { + name = "elasticache_policy" + description = "Policy to allow ElastiCache operations" + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Action = [ + "elasticache:CreateCacheSubnetGroup", + "elasticache:DeleteCacheSubnetGroup", + "elasticache:DescribeCacheSubnetGroups", + "elasticache:ModifyCacheSubnetGroup" + ] + Resource = "*" + } + ] + }) +} + +resource "aws_iam_user_policy_attachment" "elasticache_user_policy_attachment" { + user = "crossfeed-deploy-staging" + policy_arn = aws_iam_policy.elasticache_policy.arn +} \ No newline at end of file From 3205de331c70c4af958837c91dfefb0902777a7a Mon Sep 17 00:00:00 2001 From: cduhn17 Date: Thu, 18 Jul 2024 11:54:35 -0500 Subject: [PATCH 2/2] Update elasticache terraform formatting --- infrastructure/elasticache.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/elasticache.tf b/infrastructure/elasticache.tf index 3884b0c4..807b3726 100644 --- a/infrastructure/elasticache.tf +++ b/infrastructure/elasticache.tf @@ -61,4 +61,4 @@ resource "aws_iam_policy" "elasticache_policy" { resource "aws_iam_user_policy_attachment" "elasticache_user_policy_attachment" { user = "crossfeed-deploy-staging" policy_arn = aws_iam_policy.elasticache_policy.arn -} \ No newline at end of file +}