File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,16 @@ locals {
1818
1919# # IAM Bucket Policy for the Kubecost Federated Bucket
2020data "aws_iam_policy_document" "kubecost_federated_bucket_policy" {
21+ count = local. enable_kubecosts ? 1 : 0
22+
2123 statement {
2224 effect = " Allow"
2325 actions = [" s3:GetObject" , " s3:PutObject" , " s3:DeleteObject" ]
2426 principals {
2527 type = " AWS"
2628 identifiers = concat (
2729 [local . root_account_arn ],
28- [module . kubecost_pod_identity [0 ]. iam_role_arn ],
30+ [try ( module. kubecost_pod_identity [0 ]. iam_role_arn , null ) ],
2931 )
3032 }
3133 resources = [
@@ -80,7 +82,7 @@ module "kubecost_federated_bucket" {
8082 attach_require_latest_tls_policy = true
8183 force_destroy = true
8284 object_ownership = " BucketOwnerEnforced"
83- policy = data. aws_iam_policy_document . kubecost_federated_bucket_policy . json
85+ policy = data. aws_iam_policy_document . kubecost_federated_bucket_policy [ 0 ] . json
8486 tags = local. tags
8587
8688 lifecycle_rule = [
You can’t perform that action at this time.
0 commit comments