.
diff --git a/README.md b/README.md
index 11d6471..712d69b 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
-# Permission Set
+![Github Actions](../../actions/workflows/terraform.yml/badge.svg)
+
+# Terraform AWS Permission Set
This module can be used to manage permission sets and assignments within AWS Identity Center. Permission sets can use both managed and customer managed policies to define permissions. Note this module does not create the custom policies in the target accounts, it is assumed to be performed by another function.
@@ -73,7 +75,7 @@ module "permissionset" {
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | 5.41.0 |
+| [aws](#provider\_aws) | ~> 5.0 |
## Modules
@@ -95,16 +97,16 @@ module "permissionset" {
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
+| [description](#input\_description) | The description of this permission set to be created | `string` | n/a | yes |
+| [instance\_arn](#input\_instance\_arn) | The arn of the instance to which the permission set is to be attached | `string` | n/a | yes |
+| [name](#input\_name) | The name of this permission set to be created | `string` | n/a | yes |
+| [tags](#input\_tags) | The tags to be attached to the permission set | `map(string)` | n/a | yes |
| [assignments](#input\_assignments) | An optional list of assignments to be attached to the permission set | list(object({
principal_id = string
principal_type = optional(string, "GROUP")
targets = list(string)
}))
| `[]` | no |
| [customer\_managed\_boundary\_policy\_references](#input\_customer\_managed\_boundary\_policy\_references) | The list of customer managed boundary policy references to be attached to the permission set | list(object({
name = string
path = optional(string, "/")
}))
| `[]` | no |
| [customer\_managed\_policy\_references](#input\_customer\_managed\_policy\_references) | The list of customer managed policy references to be attached to the permission set | list(object({
name = string
path = optional(string, "/")
}))
| `[]` | no |
-| [description](#input\_description) | The description of this permission set to be created | `string` | n/a | yes |
-| [instance\_arn](#input\_instance\_arn) | The arn of the instance to which the permission set is to be attached | `string` | n/a | yes |
| [managed\_boundary\_policy\_arns](#input\_managed\_boundary\_policy\_arns) | The list of managed boundary policy arns to be attached to the permission set | `list(string)` | `[]` | no |
| [managed\_policy\_arns](#input\_managed\_policy\_arns) | The list of managed policy arns to be attached to the permission set | `list(string)` | `[]` | no |
-| [name](#input\_name) | The name of this permission set to be created | `string` | n/a | yes |
| [session\_duration](#input\_session\_duration) | The duration of the session | `string` | `"PT2H"` | no |
-| [tags](#input\_tags) | The tags to be attached to the permission set | `map(string)` | n/a | yes |
## Outputs
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..862d78d
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,5 @@
+# Security Policy
+
+## Reporting a Vulnerability
+
+Please contact security@appvia.io on discovery of a vulnerability or security issue.
diff --git a/examples/basics/.terraform.lock.hcl b/examples/basics/.terraform.lock.hcl
new file mode 100644
index 0000000..8a8a97e
--- /dev/null
+++ b/examples/basics/.terraform.lock.hcl
@@ -0,0 +1,25 @@
+# This file is maintained automatically by "terraform init".
+# Manual edits may be lost in future updates.
+
+provider "registry.terraform.io/hashicorp/aws" {
+ version = "5.43.0"
+ constraints = "~> 5.0"
+ hashes = [
+ "h1:3w6NCYy+mbc9odXmM7K5Xag2ggtapraacZqJR3WpJKc=",
+ "zh:07fb2abb9cf4d2042b41b2b2c642d4c4bd2feccbd856cd7040a7d15158fed478",
+ "zh:1373339e796d8d8473c267c0ecddb701559fce454c2cdd192cf8b0eadf759b48",
+ "zh:1644b4e0fd2e0b28d465bb5cf08b1f594a623324d176e879e5052f78cd2ea8cb",
+ "zh:385943b8d4170c5269b8e13e876636b7edc0ad2576edc7eb5d81cd4286a461d8",
+ "zh:48cf103f4fa866b67b686e8c085ac15264d6f020b6ad4a90f496b7283d31faa6",
+ "zh:4a4c4b4236542089d1bdb688c248e0b7c941ce42887da87e487bfb15038dcaf9",
+ "zh:5d84f3e12100bdd62a8c295b56358b82afc130642dca80d104bd868fdc28ed7c",
+ "zh:68294a601ce588a8838bcf4e136bb5ed8d2b1ee410f8871d88e35ce4861cf33f",
+ "zh:7ae1af6e9b95bd6c33dd0922216ac2b59f2f5b22fedbeab1db7a80b2f4358919",
+ "zh:89c718d41b2eeeaefd1acdbd839f1326a8c866bd49752648b0b32d3dd4a38163",
+ "zh:96e54ccb0f5ddf60465edf5c9f46e64f7d2f392507b851f102723797b4a15d09",
+ "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
+ "zh:b102ce204ebbbf32d68ff47b5224eeb60873bef5b58a7fd7790f6b4020801578",
+ "zh:cae4cb16d15ac4b15c8de5bc9dddc2032583e12c4f31e23b3a7ef22da60657dc",
+ "zh:fecbcbd63111c9518de261bcb37482cb06ee149e7298f567d45b2a55674faa75",
+ ]
+}
diff --git a/examples/basics/README.md b/examples/basics/README.md
new file mode 100644
index 0000000..e2f2ef9
--- /dev/null
+++ b/examples/basics/README.md
@@ -0,0 +1,40 @@
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | >= 1.0.7 |
+| [aws](#requirement\_aws) | >= 5.0.0 |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [aws](#provider\_aws) | 5.43.0 |
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [billing\_viewer](#module\_billing\_viewer) | ../.. | n/a |
+
+## Resources
+
+| Name | Type |
+|------|------|
+| [aws_identitystore_group.groups](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/identitystore_group) | data source |
+| [aws_organizations_organization.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organization) | data source |
+| [aws_organizations_organizational_unit_descendant_accounts.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organizational_unit_descendant_accounts) | data source |
+| [aws_ssoadmin_instances.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssoadmin_instances) | data source |
+
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|------|---------|:--------:|
+| [sso\_groups](#input\_sso\_groups) | List of SSO groups to be retreived | `list(string)` | `[]` | no |
+| [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | n/a | yes |
+
+## Outputs
+
+No outputs.
+
\ No newline at end of file
diff --git a/examples/basics/main.tf b/examples/basics/main.tf
new file mode 100644
index 0000000..f7967f8
--- /dev/null
+++ b/examples/basics/main.tf
@@ -0,0 +1,55 @@
+data "aws_organizations_organization" "this" {}
+data "aws_ssoadmin_instances" "this" {}
+
+data "aws_organizations_organizational_unit_descendant_accounts" "this" {
+ parent_id = data.aws_organizations_organization.this.roots[0].id
+}
+
+# Lookup all the sso groups
+data "aws_identitystore_group" "groups" {
+ for_each = toset(var.sso_groups)
+
+ identity_store_id = local.identity_store_id
+
+ alternate_identifier {
+ unique_attribute {
+ attribute_path = "DisplayName"
+ attribute_value = each.value
+ }
+ }
+}
+
+locals {
+ identity_store_id = tolist(data.aws_ssoadmin_instances.this.identity_store_ids)[0]
+ instance_arn = tolist(data.aws_ssoadmin_instances.this.arns)[0]
+
+ accounts = {
+ for x in data.aws_organizations_organizational_unit_descendant_accounts.this.accounts :
+ x.name => x.id if x.status == "ACTIVE"
+ }
+}
+
+#
+## Define the permission set
+#
+module "billing_viewer" {
+ source = "../.."
+
+ name = "BillingViewer"
+ description = "Permissons to view only billing information"
+ tags = var.tags
+ instance_arn = local.instance_arn
+
+ managed_policy_arns = [
+ "arn:aws:iam::aws:policy/AWSBillingConductorReadOnlyAccess",
+ "arn:aws:iam::aws:policy/AWSBillingReadOnlyAccess",
+ "arn:aws:iam::aws:policy/CostOptimizationHubReadOnlyAccess",
+ ]
+
+ assignments = [
+ {
+ principal_id = data.aws_identitystore_group.groups["Cloud Billing"].group_id
+ targets = [local.accounts["appvia.io"]]
+ }
+ ]
+}
diff --git a/examples/basics/terraform.tf b/examples/basics/terraform.tf
new file mode 100644
index 0000000..6f48074
--- /dev/null
+++ b/examples/basics/terraform.tf
@@ -0,0 +1,11 @@
+
+terraform {
+ required_version = ">= 1.0.7"
+
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = ">= 5.0.0"
+ }
+ }
+}
diff --git a/examples/basics/variables.tf b/examples/basics/variables.tf
new file mode 100644
index 0000000..cada39a
--- /dev/null
+++ b/examples/basics/variables.tf
@@ -0,0 +1,10 @@
+variable "sso_groups" {
+ description = "List of SSO groups to be retreived"
+ type = list(string)
+ default = []
+}
+
+variable "tags" {
+ description = "A map of tags to add to all resources"
+ type = map(string)
+}