-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GOVSI-1055: Create Redis access policies within OIDC module
These can be removed from shared after the migration
- Loading branch information
Showing
3 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
data "aws_ssm_parameter" "redis_master_host" { | ||
name = "${var.environment}-${local.redis_key}-redis-master-host" | ||
} | ||
|
||
data "aws_ssm_parameter" "redis_replica_host" { | ||
name = "${var.environment}-${local.redis_key}-redis-replica-host" | ||
} | ||
|
||
data "aws_ssm_parameter" "redis_tls" { | ||
name = "${var.environment}-${local.redis_key}-redis-tls" | ||
} | ||
|
||
data "aws_ssm_parameter" "redis_password" { | ||
name = "${var.environment}-${local.redis_key}-redis-password" | ||
} | ||
|
||
data "aws_ssm_parameter" "redis_port" { | ||
name = "${var.environment}-${local.redis_key}-redis-port" | ||
} | ||
|
||
data "aws_iam_policy_document" "redis_parameter_policy" { | ||
statement { | ||
sid = "AllowGetParameters" | ||
effect = "Allow" | ||
|
||
actions = [ | ||
"ssm:GetParameter", | ||
"ssm:GetParameters", | ||
] | ||
|
||
resources = [ | ||
data.aws_ssm_parameter.redis_master_host.arn, | ||
data.aws_ssm_parameter.redis_replica_host.arn, | ||
data.aws_ssm_parameter.redis_tls.arn, | ||
data.aws_ssm_parameter.redis_password.arn, | ||
data.aws_ssm_parameter.redis_port.arn, | ||
] | ||
} | ||
statement { | ||
sid = "AllowDecryptOfParameters" | ||
effect = "Allow" | ||
|
||
actions = [ | ||
"kms:Decrypt", | ||
] | ||
|
||
resources = [ | ||
local.lambda_parameter_encryption_alias_id, | ||
local.lambda_parameter_encryption_key_id | ||
] | ||
} | ||
} | ||
|
||
resource "aws_iam_policy" "redis_parameter_policy" { | ||
policy = data.aws_iam_policy_document.redis_parameter_policy.json | ||
path = "/${var.environment}/redis/${local.redis_key}/" | ||
name_prefix = "parameter-store-policy" | ||
} | ||
|
||
## Password pepper policy | ||
|
||
data "aws_ssm_parameter" "password_pepper" { | ||
name = "${var.environment}-password-pepper" | ||
} | ||
|
||
data "aws_iam_policy_document" "pepper_parameter_policy" { | ||
statement { | ||
sid = "AllowGetParameters" | ||
effect = "Allow" | ||
|
||
actions = [ | ||
"ssm:GetParameter", | ||
"ssm:GetParameters", | ||
] | ||
|
||
resources = [ | ||
data.aws_ssm_parameter.password_pepper.arn | ||
] | ||
} | ||
statement { | ||
sid = "AllowDecryptOfParameters" | ||
effect = "Allow" | ||
|
||
actions = [ | ||
"kms:Decrypt", | ||
] | ||
|
||
resources = [ | ||
local.lambda_parameter_encryption_alias_id, | ||
local.lambda_parameter_encryption_key_id | ||
] | ||
} | ||
} | ||
|
||
resource "aws_iam_policy" "pepper_parameter_policy" { | ||
policy = data.aws_iam_policy_document.pepper_parameter_policy[0].json | ||
path = "/${var.environment}/lambda-parameters/" | ||
name_prefix = "pepper-parameter-store-policy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters