generated from cloudposse/terraform-example-module
-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com>
- Loading branch information
1 parent
bcc80c2
commit b4c1b3d
Showing
33 changed files
with
703 additions
and
942 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
*.tfstate.* | ||
.terraform | ||
.terraform.tfstate.lock.info | ||
.terraform.lock.hcl | ||
|
||
**/.idea | ||
**/*.iml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,18 @@ | ||
<!-- markdownlint-disable --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | >= 0.12.0, < 0.14.0 | | ||
| local | ~> 1.2 | | ||
| random | ~> 2.2 | | ||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| random | ~> 2.2 | | ||
No provider. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no | | ||
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no | | ||
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no | | ||
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | ||
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | ||
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | | ||
| example | Example variable | `string` | `"hello world"` | no | | ||
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no | | ||
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no | | ||
| name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no | | ||
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | | ||
| regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | ||
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | ||
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no | | ||
No input. | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| example | Example output | | ||
| id | ID of the created example | | ||
| random | Stable random number for this example | | ||
No output. | ||
|
||
<!-- markdownlint-restore --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
enabled = true | ||
namespace = "eg" | ||
name = "aws-sso" | ||
stage = "test" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,66 @@ | ||
module "example" { | ||
source = "../.." | ||
module "permission_sets" { | ||
source = "../../modules/permission-sets" | ||
|
||
example = var.example | ||
permission_sets = [ | ||
{ | ||
name = "AdministratorAccess", | ||
description = "Allow Full Access to the account", | ||
relay_state = "", | ||
session_duration = "", | ||
tags = {}, | ||
inline_policy = "", | ||
policy_attachments = ["arn:aws:iam::aws:policy/AdministratorAccess"] | ||
}, | ||
{ | ||
name = "S3AdministratorAccess", | ||
description = "Allow Full S3 Admininstrator access to the account", | ||
relay_state = "", | ||
session_duration = "", | ||
tags = {}, | ||
inline_policy = data.aws_iam_policy_document.S3Access.json, | ||
policy_attachments = [] | ||
} | ||
] | ||
context = module.this.context | ||
} | ||
|
||
module "sso_account_assignments" { | ||
source = "../../modules/account-assignments" | ||
|
||
account_assignments = [ | ||
{ | ||
account = "111111111111", // Represents the "production" account | ||
permission_set_arn = module.permission_sets.permission_sets["AdministratorAccess"].arn, | ||
principal_type = "GROUP", | ||
principal_name = "Administrators" | ||
}, | ||
{ | ||
account = "111111111111", | ||
permission_set_arn = module.permission_sets.permission_sets["S3AdministratorAccess"].arn, | ||
principal_type = "GROUP", | ||
principal_name = "S3Adminstrators" | ||
}, | ||
{ | ||
account = "222222222222", // Represents the "Sandbox" account | ||
permission_set_arn = module.permission_sets.permission_sets["AdministratorAccess"].arn, | ||
principal_type = "GROUP", | ||
principal_name = "Developers" | ||
}, | ||
] | ||
context = module.this.context | ||
} | ||
|
||
#----------------------------------------------------------------------------------------------------------------------- | ||
# CREATE SOME IAM POLCIES TO ATTACH AS INLINE | ||
#----------------------------------------------------------------------------------------------------------------------- | ||
data "aws_iam_policy_document" "S3Access" { | ||
statement { | ||
sid = "1" | ||
|
||
actions = ["*"] | ||
|
||
resources = [ | ||
"arn:aws:s3:::*", | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +0,0 @@ | ||
output "id" { | ||
description = "ID of the created example" | ||
value = module.example.id | ||
} | ||
|
||
output "example" { | ||
description = "Output \"example\" from example module" | ||
value = module.example.example | ||
} | ||
|
||
output "random" { | ||
description = "Output \"random\" from example module" | ||
value = module.example.random | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
variable "example" { | ||
type = string | ||
description = "The value which will be passed to the example module" | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.