Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
fix: Use customer managed policy instead of inline policy for `cluste…
Browse files Browse the repository at this point in the history
…r_elb_sl_role_creation` (terraform-aws-modules#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.
  • Loading branch information
wlonkly authored and BARRY Thierno Ibrahima (Canal Plus Prestataire) committed Oct 25, 2020
1 parent f2aefd9 commit 742b25f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 742b25f

Please sign in to comment.