# iam-policy

Creates AWS IAM managed policies and permission boundary policies.

Provisions any number of customer-managed IAM policies and permission boundary policies from caller-supplied JSON policy documents. Policy and boundary definitions are provided as maps, making it straightforward to manage a library of reusable policies in one module call.

## Usage

```hcl
module "iam_policies" {
  source  = "hcassc.jfrog.io/iac-terraform-modules-virtual/identity/iam-policy/aws"
  version = "0.1.0"

  policies = {
    s3_read = {
      name   = "s3-read-only"
      policy = data.aws_iam_policy_document.s3_read.json
    }
  }

  permission_boundaries = {
    developer = {
      name   = "developer-boundary"
      policy = data.aws_iam_policy_document.dev_boundary.json
    }
  }
}
```

<!-- BEGIN_TF_DOCS — DO NOT EDIT BELOW THIS LINE -->
## Requirements

| Name | Version |
| ---- | ------- |
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | ~> 1.5 |
| <a name="requirement_aws"></a> [aws](#requirement_aws) | ~> 6.50 |

## Providers

| Name | Version |
| ---- | ------- |
| <a name="provider_aws"></a> [aws](#provider_aws) | 6.50.0 |

## Resources

| Name | Type |
| ---- | ---- |
| [aws_iam_policy.boundary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
| [aws_iam_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |

## Inputs

| Name | Description | Type | Default | Required |
| ---- | ----------- | ---- | ------- | :------: |
| <a name="input_permission_boundaries"></a> [permission_boundaries](#input_permission_boundaries) | Map of permission boundary policy definitions to create | <pre>map(object({<br/>    name        = string<br/>    description = optional(string, "")<br/>    path        = optional(string, "/")<br/>    policy      = string # JSON policy document<br/>  }))</pre> | `{}` | no |
| <a name="input_policies"></a> [policies](#input_policies) | Map of IAM managed policies to create | <pre>map(object({<br/>    name        = string<br/>    description = optional(string, "")<br/>    path        = optional(string, "/")<br/>    policy      = string # JSON policy document<br/>  }))</pre> | `{}` | no |
| <a name="input_tags"></a> [tags](#input_tags) | Resource tags to apply to all resources | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
| ---- | ----------- |
| <a name="output_boundary_arns"></a> [boundary_arns](#output_boundary_arns) | Map of permission boundary logical key to ARN |
| <a name="output_boundary_ids"></a> [boundary_ids](#output_boundary_ids) | Map of permission boundary logical key to ID |
| <a name="output_policy_arns"></a> [policy_arns](#output_policy_arns) | Map of policy logical key to ARN |
| <a name="output_policy_ids"></a> [policy_ids](#output_policy_ids) | Map of policy logical key to ID |
<!-- END_TF_DOCS — DO NOT EDIT ABOVE THIS LINE -->
