@@ -6,14 +6,49 @@ resource "aws_organizations_account" "identity" {
66 role_name = " ${ var . account_role_name } "
77}
88
9+ locals {
10+ identity_account_arn = " ${ join (" " , aws_organizations_account. identity . * . arn )} "
11+ identity_account_id = " ${ join (" " , aws_organizations_account. identity . * . id )} "
12+ identity_organization_account_access_role = " arn:aws:iam::${ join (" " , aws_organizations_account. identity . * . id )} :role/OrganizationAccountAccessRole"
13+ }
14+
15+ module "identity_parameters" {
16+ source = " git::https://github.com/cloudposse/terraform-aws-ssm-parameter-store?ref=tags/0.1.5"
17+ enabled = " ${ contains (var. accounts_enabled , " identity" ) == true ? " true" : " false" } "
18+
19+ parameter_write = [
20+ {
21+ name = " /${ var . namespace } /identity/account_id"
22+ value = " ${ local . identity_account_id } "
23+ type = " String"
24+ overwrite = " true"
25+ description = " AWS Account ID"
26+ },
27+ {
28+ name = " /${ var . namespace } /identity/account_arn"
29+ value = " ${ local . identity_account_arn } "
30+ type = " String"
31+ overwrite = " true"
32+ description = " AWS Account ARN"
33+ },
34+ {
35+ name = " /${ var . namespace } /identity/organization_account_access_role"
36+ value = " ${ local . identity_organization_account_access_role } "
37+ type = " String"
38+ overwrite = " true"
39+ description = " AWS Organization Account Access Role"
40+ },
41+ ]
42+ }
43+
944output "identity_account_arn" {
10- value = " ${ join ( " " , aws_organizations_account . identity . * . arn ) } "
45+ value = " ${ local . identity_account_arn } "
1146}
1247
1348output "identity_account_id" {
14- value = " ${ join ( " " , aws_organizations_account . identity . * . id ) } "
49+ value = " ${ local . identity_account_id } "
1550}
1651
1752output "identity_organization_account_access_role" {
18- value = " arn:aws:iam:: ${ join ( " " , aws_organizations_account . identity . * . id ) } :role/OrganizationAccountAccessRole "
53+ value = " ${ local . identity_organization_account_access_role } "
1954}
0 commit comments