Skip to content

Commit a1591bd

Browse files
committed
feat: adds submodule to attaching organizations policy
1 parent 2512bd2 commit a1591bd

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Terraform AWS Organizations Policy Attachement module
2+
A Terraform module for attaching policies to organizational unit or accounts
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Terraform AWS Organizations Policy Attachement module
2+
A Terraform module for attaching policies to organizational unit or accounts
3+
4+
## Requirements
5+
6+
| Name | Version |
7+
|------|---------|
8+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.4.6 |
9+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.65.0 |
10+
11+
## Providers
12+
13+
| Name | Version |
14+
|------|---------|
15+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.65.0 |
16+
17+
## Modules
18+
19+
No modules.
20+
21+
## Resources
22+
23+
| Name | Type |
24+
|------|------|
25+
| [aws_organizations_policy_attachment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy_attachment) | resource |
26+
27+
## Inputs
28+
29+
| Name | Description | Type | Default | Required |
30+
|------|-------------|------|---------|:--------:|
31+
| <a name="input_policy_id"></a> [policy\_id](#input\_policy\_id) | (Required) The unique identifier (ID) of the policy that you want to attach to the target. | `string` | n/a | yes |
32+
| <a name="input_skip_destroy"></a> [skip\_destroy](#input\_skip\_destroy) | (Optional) If set to true, destroy will not detach the policy and instead just remove the resource from state. | `bool` | `false` | no |
33+
| <a name="input_target_id"></a> [target\_id](#input\_target\_id) | (Required) The unique identifier (ID) of the root, organizational unit, or account number that you want to attach the policy to. | `string` | n/a | yes |
34+
35+
## Outputs
36+
37+
No outputs.

modules/policy_attachment/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "aws_organizations_policy_attachment" "this" {
2+
policy_id = var.policy_id
3+
target_id = var.target_id
4+
skip_destroy = var.skip_destroy
5+
}

modules/policy_attachment/outputs.tf

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
variable "policy_id" {
2+
description = "(Required) The unique identifier (ID) of the policy that you want to attach to the target."
3+
type = string
4+
}
5+
6+
variable "target_id" {
7+
description = "(Required) The unique identifier (ID) of the root, organizational unit, or account number that you want to attach the policy to."
8+
type = string
9+
}
10+
11+
variable "skip_destroy" {
12+
description = "(Optional) If set to true, destroy will not detach the policy and instead just remove the resource from state."
13+
type = bool
14+
default = false
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.4.6"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 4.65.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)