Skip to content

Commit f69d245

Browse files
authored
Merge pull request #17 from mbevc1/20210105_tags
Add resource tags
2 parents 63e7473 + b9e1748 commit f69d245

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Supports two main use cases:
44

5-
* Combines multiple Service Control Policy (SCP) statements based on the policies defined in [`terraform-aws-org-scp`](https://github.com/trussworks/terraform-aws-org-scp). Combining multiple policy statements into a single policy allows more than 5 policies to be be applied to a single Organizational Unit (OU).
5+
* Combines multiple Service Control Policy (SCP) statements - based on the module [`terraform-aws-org-scp`](https://github.com/trussworks/terraform-aws-org-scp) (_deprecated_). Combining multiple policy statements into a single policy allows more than 5 policies to be be applied to a single Organizational Unit (OU).
66
* Alternatively, creates a "Deny All Access" Service Control Policy.
77

88
Alternatively, enables creation of a "Deny All Access" Service Control Policy.
@@ -69,6 +69,11 @@ module "github_terraform_aws_ou_scp" {
6969
7070
# require s3 objects be encrypted
7171
require_s3_encryption = true
72+
73+
# SCP policy tags
74+
tags = {
75+
managed_by = "terraform"
76+
}
7277
}
7378
```
7479

@@ -119,6 +124,7 @@ module "github_terraform_aws_ou_scp" {
119124
| protect\_s3\_buckets | ProtectS3Buckets in the OU policy. | `bool` | `false` | no |
120125
| require\_s3\_encryption | DenyIncorrectEncryptionHeader and DenyUnEncryptedObjectUploads in the OU policy | `bool` | `false` | no |
121126
| target | OU resource to attach SCP | <pre>object({<br> name = string<br> id = string<br> })</pre> | n/a | yes |
127+
| tags | Tags to attach to the SCP policy resource | `map(string)` | <pre>[]</pre> | no |
122128

123129
## Outputs
124130

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ resource "aws_organizations_policy" "generated" {
279279
name = "${var.target.name}-generated-ou-scp"
280280
description = "${var.target.name} SCP generated by ou-scp module"
281281
content = var.deny_all ? data.aws_iam_policy_document.deny_all_access.json : data.aws_iam_policy_document.combined_policy_block.json
282+
283+
tags = var.tags
282284
}
283285

284286
resource "aws_organizations_policy_attachment" "generated" {
285287
policy_id = aws_organizations_policy.generated.id
286288
target_id = var.target.id
287-
}
289+
}

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ variable "allowed_regions" {
104104
description = "AWS Regions allowed for use (for use with the restrict regions SCP)"
105105
type = list(string)
106106
default = [""]
107-
}
107+
}
108+
109+
variable "tags" {
110+
description = "Tags applied to the SCP policy"
111+
type = map(string)
112+
default = []
113+
}

0 commit comments

Comments
 (0)