Skip to content

octoenergy/terraform-provider-splitpolicies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

043d751 · Sep 24, 2024

History

24 Commits
Sep 24, 2024
Mar 13, 2023
Sep 24, 2024
Mar 6, 2023
Sep 24, 2024
Sep 24, 2024
Mar 6, 2023
Mar 13, 2023
Mar 13, 2023
Mar 2, 2023
Mar 6, 2023
Sep 24, 2024
Sep 24, 2024
Mar 13, 2023
Mar 2, 2023

Repository files navigation

Terraform Policy Splitter

This provider has one simple job - to take an array of documents and to combine them into documents no larger than a given size. The driving force behind this is to take a list of AWS policies and combine them into large policy documents that don't overflow then AWS-imposed limit of 6144 bytes. The chunk size can be configured though.

Usage

data "splitpolicies" "test" {
  policies = ["one", "two", "three"]
  maximum_chunk_size = 6
}

data "aws_iam_policy_document" "policy_docs" {
  for_each                = data.splitpolicies.test.chunks
  source_policy_documents = each.value
}

resource "aws_iam_policy" "policies" {
    for_each = data.aws_iam_policy_document.policy_docs
    policy   = each.value.json
}