Skip to content

Commit

Permalink
corrected iam policy
Browse files Browse the repository at this point in the history
  • Loading branch information
kunduso committed Nov 2, 2023
1 parent 8a41641 commit 2f99788
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions iam_role.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
locals {
account_id = aws_vpc.this.owner_id
}
#Create a policy to read from the specific parameter store
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy
resource "aws_iam_policy" "ssm_parameter_policy" {
Expand All @@ -19,6 +16,13 @@ resource "aws_iam_policy" "ssm_parameter_policy" {
"ssm:GetParameter"
],
Resource = [aws_ssm_parameter.elasticache_ep.arn, aws_ssm_parameter.elasticache_port.arn]
},
{
Effect = "Allow",
Action = [
"kms:Decrypt"
]
Resource = [aws_kms_key.encrytion_rest.arn]
}
]
})
Expand All @@ -33,12 +37,19 @@ resource "aws_iam_policy" "secret_manager_policy" {
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow",
Action = [
"secretsmanager:GetSecretValue"
]
Resource = [aws_secretsmanager_secret_version.auth.arn]
},
{
Effect = "Allow",
Action = [
"kms:Decrypt"
]
Resource = [aws_kms_key.encrytion_rest.arn]
Resource = [aws_kms_key.encrytion_secret.arn]
}
]
})
Expand Down

0 comments on commit 2f99788

Please sign in to comment.