File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,29 @@ resource "aws_iam_role" "this" {
219
219
permissions_boundary = var. iam_role_permissions_boundary
220
220
force_detach_policies = true
221
221
222
+ # https://github.com/terraform-aws-modules/terraform-aws-eks/issues/920
223
+ # Resources running on the cluster are still generaring logs when destroying the module resources
224
+ # which results in the log group being re-created even after Terraform destroys it. Removing the
225
+ # ability for the cluster role to create the log group prevents this log group from being re-created
226
+ # outside of Terraform due to services still generating logs during destroy process
227
+ dynamic "inline_policy" {
228
+ for_each = var. create_cloudwatch_log_group ? [1 ] : []
229
+ content {
230
+ name = local. iam_role_name
231
+
232
+ policy = jsonencode ({
233
+ Version = " 2012-10-17"
234
+ Statement = [
235
+ {
236
+ Action = [" logs:CreateLogGroup" ]
237
+ Effect = " Deny"
238
+ Resource = aws_cloudwatch_log_group.this[0 ].arn
239
+ },
240
+ ]
241
+ })
242
+ }
243
+ }
244
+
222
245
tags = merge (var. tags , var. iam_role_tags )
223
246
}
224
247
You can’t perform that action at this time.
0 commit comments