Skip to content

Commit

Permalink
Add example for all in one
Browse files Browse the repository at this point in the history
  • Loading branch information
rakiyoshi committed Aug 4, 2021
1 parent f30ccd3 commit d5d47ba
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 6 deletions.
52 changes: 52 additions & 0 deletions examples/all-in-one/README.md
Original file line number Diff line number Diff line change
@@ -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
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >=3.24.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.24.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_all_assignments"></a> [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 |
|------|-------------|------|---------|:--------:|
| <a name="input_assignments_all"></a> [assignments\_all](#input\_assignments\_all) | All of account assignments. | `map(map(map(list(string))))` | n/a | yes |
| <a name="input_sso_region"></a> [sso\_region](#input\_sso\_region) | Region of your AWS SSO instance. | `string` | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
7 changes: 3 additions & 4 deletions examples/all-in-one/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ locals {
accounts = data.aws_organizations_organization.organization.accounts
}

module "sample_assignments" {
# TODO: Replace with the module of Terraform Registry
source = "[email protected]: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
}
Empty file added examples/all-in-one/outputs.tf
Empty file.
41 changes: 41 additions & 0 deletions examples/all-in-one/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
assignments_all = {
"account1" = {
"groups" = {
"SystemAdministrator" = [
"AdministratorAccess",
],
"Engineer" = [
"PowerUserAccess",
],
"Manager" = [
"ReadOnlyAccess",
],
},
"users" = {
"[email protected]" = [
"AdministratorAccess",
],
},
},
"account2" = {
"groups" = {
"SystemAdministrator" = [
"AdministratorAccess",
],
"Engineer" = [
"PowerUserAccess",
],
"Manager" = [
"ReadOnlyAccess",
],
},
"users" = {
"[email protected]" = [
"AdministratorAccess",
],
"[email protected]" = [
"ReadOnlyAccess",
],
},
},
}
3 changes: 2 additions & 1 deletion examples/all-in-one/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
2 changes: 1 addition & 1 deletion examples/all-in-one/version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">=3.52.0"
version = ">=3.24.0"
}
}
}

0 comments on commit d5d47ba

Please sign in to comment.