diff --git a/examples/all-in-one/README.md b/examples/all-in-one/README.md new file mode 100644 index 0000000..df3ffb3 --- /dev/null +++ b/examples/all-in-one/README.md @@ -0,0 +1,52 @@ +# All account assignments in a single module + +Define all account assignments in a single module. + +## Usage + +To run this example you need to execute: + +```bash +$ terraform init +$ terraform plan +$ terraform apply +``` + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.3 | +| [aws](#requirement\_aws) | >=3.24.0 | + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | 3.24.0 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [all\_assignments](#module\_all\_assignments) | ../.. | n/a | + +## Resources + +| Name | Type | +|------|------| +| [aws_organizations_organization.organization](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organization) | data source | +| [aws_ssoadmin_instances.instances](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssoadmin_instances) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [assignments\_all](#input\_assignments\_all) | All of account assignments. | `map(map(map(list(string))))` | n/a | yes | +| [sso\_region](#input\_sso\_region) | Region of your AWS SSO instance. | `string` | n/a | yes | + +## Outputs + +No outputs. + diff --git a/examples/all-in-one/main.tf b/examples/all-in-one/main.tf index 2bef92e..10b9902 100644 --- a/examples/all-in-one/main.tf +++ b/examples/all-in-one/main.tf @@ -8,14 +8,13 @@ locals { accounts = data.aws_organizations_organization.organization.accounts } -module "sample_assignments" { - # TODO: Replace with the module of Terraform Registry - source = "git@github.com:speee/terraform-aws-sso-assignment.git" +module "all_assignments" { + source = "../.." instance_arn = local.instance_arn identity_store_id = local.identity_store_id organization_accounts = local.accounts - assignments = var.assignments_sample + assignments = var.assignments_all } diff --git a/examples/all-in-one/outputs.tf b/examples/all-in-one/outputs.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/all-in-one/terraform.tfvars b/examples/all-in-one/terraform.tfvars new file mode 100644 index 0000000..eefc46a --- /dev/null +++ b/examples/all-in-one/terraform.tfvars @@ -0,0 +1,41 @@ +assignments_all = { + "account1" = { + "groups" = { + "SystemAdministrator" = [ + "AdministratorAccess", + ], + "Engineer" = [ + "PowerUserAccess", + ], + "Manager" = [ + "ReadOnlyAccess", + ], + }, + "users" = { + "alice@example.com" = [ + "AdministratorAccess", + ], + }, + }, + "account2" = { + "groups" = { + "SystemAdministrator" = [ + "AdministratorAccess", + ], + "Engineer" = [ + "PowerUserAccess", + ], + "Manager" = [ + "ReadOnlyAccess", + ], + }, + "users" = { + "alice@example.com" = [ + "AdministratorAccess", + ], + "bob@example.com" = [ + "ReadOnlyAccess", + ], + }, + }, +} diff --git a/examples/all-in-one/variables.tf b/examples/all-in-one/variables.tf index a0340c9..96fcece 100644 --- a/examples/all-in-one/variables.tf +++ b/examples/all-in-one/variables.tf @@ -4,5 +4,6 @@ variable "sso_region" { } variable "assignments_all" { - type = map(map(map(list(string)))) + type = map(map(map(list(string)))) + description = "All of account assignments." } diff --git a/examples/all-in-one/version.tf b/examples/all-in-one/version.tf index 0a54aab..9a25607 100644 --- a/examples/all-in-one/version.tf +++ b/examples/all-in-one/version.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">=3.52.0" + version = ">=3.24.0" } } }