-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fd0789
commit 88b92c4
Showing
4 changed files
with
60 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# AWS Organizations Tag Policy | ||
|
||
This Terraform module creates and attaches an AWS Organizations TAG Policy. The policy allows you to specify which resources to be tagged of for your AWS Organization or specific AWS accounts. | ||
|
||
## Resources | ||
|
||
- `aws_organizations_policy`: Creates the tag policy. | ||
- `aws_organizations_policy_attachment`: Attaches the tag policy to specified AWS Organization Units (OUs) or AWS accounts. | ||
|
||
## Variables | ||
|
||
### `policy_name` | ||
|
||
- **Description**: The name of the Tag policy. | ||
- **Type**: `string` | ||
- **Default**: `"TagPolicy"` | ||
|
||
### `policy_description` | ||
|
||
- **Description**: The description of the Tag policy. | ||
- **Type**: `string` | ||
- **Default**: `"This Tag Policy will apply tags to resources"` | ||
|
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,9 @@ | ||
{ | ||
"tags": { | ||
"CostCentre": { | ||
"tag_key": { | ||
"@@assign": "CostCentre" | ||
} | ||
} | ||
} | ||
} |
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,15 @@ | ||
resource "aws_organizations_policy" "mandatory_tag_policy" { | ||
name = var.policy_name | ||
description = var.policy_description | ||
type = "TAG_POLICY" | ||
content = file( | ||
"./enforce_mandatory_tag_values.template", | ||
) | ||
} | ||
|
||
|
||
resource "aws_organizations_policy_attachment" "mandatory_tags" { | ||
policy_id = aws_organizations_policy.mandatory_tag_policy.id | ||
target_id = aws_organizations_organization.mandatory_tag_policy.roots[0].id | ||
} | ||
|
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,13 @@ | ||
variable "policy_name" { | ||
description = "The name of the tag policy" | ||
type = string | ||
default = "TagPolicy" | ||
} | ||
|
||
variable "policy_description" { | ||
description = "The description of the tag policy" | ||
type = string | ||
default = "Policy to add tags to resources" | ||
} | ||
|
||
|