Skip to content

Commit

Permalink
adding secrets policy
Browse files Browse the repository at this point in the history
  • Loading branch information
sohanyadav committed Oct 28, 2024
1 parent 6e2b284 commit a77d178
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions aws_csi_secrets_store.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "aws_iam_policy" "secrets_policy" {
"secretsmanager:DescribeSecret"
],
Resource = [
"arn:aws:secretsmanager:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:secret:testing-KBgXuY"
"arn:aws:secretsmanager:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:secret:*"
]
}
]
Expand All @@ -59,16 +59,21 @@ data "aws_iam_policy_document" "trust_relationship" {

principals {
type = "Federated"
identifiers = [replace(aws_eks_cluster.cluster.identity[0].oidc.issuer, "https://", "")]
identifiers = [replace(aws_eks_cluster.cluster.identity[0].oidc[0].issuer, "https://", "")]
}

actions = ["sts:AssumeRoleWithWebIdentity"]

condition {
test = "StringEquals"
variable = "${replace(aws_eks_cluster.cluster.identity[0].oidc.issuer, "https://", "")}:aud"
variable = "${replace(aws_eks_cluster.cluster.identity[0].oidc[0].issuer, "https://", "")}:aud"
values = ["sts.amazonaws.com"]
}
condition {
test = "StringEquals"
variable = "${replace(aws_eks_cluster.cluster.identity[0].oidc[0].issuer, "https://", "")}:sub"
values = ["system:serviceaccount:*:*"]
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,12 @@ variable "karpenter_ami_family" {
}

variable "csi_secrets_store_enabled" {
default = false
default = true
description = "Specify whether the CSI driver is enabled on the EKS cluster"
}

variable "csi_secrets_store_version" {
default = "1.3.4"
default = "1.4.6"
description = "The version of the CSI store helm chart"
}

Expand Down

0 comments on commit a77d178

Please sign in to comment.