Organization.roots[0].id is null #27882

Hello there:

Datasource:

data "aws_organizations_organization" "organization" {}

Create OU:

resource "aws_organizations_organizational_unit" "level_1_ous" {
  count = length(local.level_1_ou_arguments)
  name = local.level_1_ou_arguments[count.index].name
  parent_id = data.aws_organizations_organization.organization.roots.0.id
}

Problem:

Error: Attempt to index null value

  on .terraform/modules/organisation/organization/ou.tf line 32, in resource "aws_organizations_organizational_unit" "level_1_ous":
  32:   parent_id = data.aws_organizations_organization.organization.roots.0.id
    |----------------
    | data.aws_organizations_organization.organization.roots is null

This value is null, so it does not have any indices

What I did for try to resolve this problem:

  • [nr] Added permission to my Admin account
  • [nr] input string with ID Root Org

Can anybody help me?

Hi,
I am experiencing the same issue did you find a solution ?
Thanks

You need to switch you organization to Advanced modeā€¦