29 lines
721 B
Terraform
29 lines
721 B
Terraform
|
data "aws_eks_cluster_auth" "self" {
|
||
|
name = var.eks_cluster_id
|
||
|
}
|
||
|
|
||
|
data "aws_iam_policy_document" "self_assume_role_policy" {
|
||
|
statement {
|
||
|
actions = ["sts:AssumeRoleWithWebIdentity"]
|
||
|
effect = "Allow"
|
||
|
|
||
|
condition {
|
||
|
test = "StringEquals"
|
||
|
variable = "${replace(var.eks_cluster_oidc_issuer_url, "https://", "")}:sub"
|
||
|
values = ["system:serviceaccount:kube-system:ebs-csi-controller-sa"]
|
||
|
}
|
||
|
condition {
|
||
|
test = "StringEquals"
|
||
|
variable = "${replace(var.eks_cluster_oidc_issuer_url, "https://", "")}:aud"
|
||
|
values = ["sts.amazonaws.com"]
|
||
|
}
|
||
|
|
||
|
principals {
|
||
|
identifiers = [
|
||
|
var.eks_oidc_provider_arn
|
||
|
]
|
||
|
type = "Federated"
|
||
|
}
|
||
|
}
|
||
|
}
|