mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-17 00:57:28 +01:00
fix: Use customer managed policy instead of inline policy for cluster_elb_sl_role_creation (#1039)
NOTE: The usage of customer managed policy, not an inline policy, for the `cluster_elb_sl_role_creation policy` is common for "enterprise" AWS users to disallow inline policies with an SCP rule for auditing-related reasons, and this accomplishes the same thing.
This commit is contained in:
10
cluster.tf
10
cluster.tf
@@ -158,9 +158,15 @@ data "aws_iam_policy_document" "cluster_elb_sl_role_creation" {
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy" "cluster_elb_sl_role_creation" {
|
||||
resource "aws_iam_policy" "cluster_elb_sl_role_creation" {
|
||||
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
|
||||
name_prefix = "${var.cluster_name}-elb-sl-role-creation"
|
||||
role = local.cluster_iam_role_name
|
||||
description = "Permissions for EKS to create AWSServiceRoleForElasticLoadBalancing service-linked role"
|
||||
policy = data.aws_iam_policy_document.cluster_elb_sl_role_creation[0].json
|
||||
}
|
||||
|
||||
resource "aws_iam_role_policy_attachment" "cluster_elb_sl_role_creation" {
|
||||
count = var.manage_cluster_iam_resources && var.create_eks ? 1 : 0
|
||||
policy_arn = aws_iam_policy.cluster_elb_sl_role_creation[0].arn
|
||||
role = local.cluster_iam_role_name
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user