File tree Expand file tree Collapse file tree 5 files changed +25
-15
lines changed Expand file tree Collapse file tree 5 files changed +25
-15
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ data "aws_organizations_organization" "org" {}
2+
13resource "aws_organizations_organizational_unit" "this" {
2- name = var. name
3- parent_id = data. aws_organizations_organization . org . roots [0 ]. id
4+ name = var. organizational_unit_name
5+ parent_id = var. parent_org_id != " " ? var. parent_org_id : data. aws_organizations_organization . org . roots [0 ]. id
6+ }
7+
8+ resource "aws_organizations_policy_attachment" "policy_attachment" {
9+ count = length (var. attached_policies )
10+ policy_id = var. attached_policies [count . index ]
11+ target_id = aws_organizations_organizational_unit. this . id
412}
Original file line number Diff line number Diff line change 1- output "id " {
2- description = " The ID of the organizational unit"
1+ output "organizational_unit_id " {
2+ description = " The ID of the created organizational unit. "
33 value = aws_organizations_organizational_unit. this . id
44}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- variable "name " {
1+ variable "organizational_unit_name " {
22 description = " The name of the organizational unit"
33 type = string
44}
5+
6+ variable "parent_org_id" {
7+ description = " The ID of the parent organizational unit."
8+ type = string
9+ default = " "
10+ }
11+
12+ variable "attached_policies" {
13+ description = " List of policy IDs to attach to the organizational unit."
14+ type = list (string )
15+ default = []
16+ }
You can’t perform that action at this time.
0 commit comments