|
1 | | -resource "aws_organizations_account" "identity" { |
2 | | - count = "${contains(var.accounts_enabled, "identity") == true ? 1 : 0}" |
3 | | - name = "identity" |
4 | | - email = "${format(var.account_email, "identity")}" |
5 | | - iam_user_access_to_billing = "${var.account_iam_user_access_to_billing}" |
6 | | - role_name = "${var.account_role_name}" |
7 | | -} |
8 | | - |
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 | | - ] |
| 1 | +module "identity" { |
| 2 | + source = "stage" |
| 3 | + namespace = "${var.namespace}" |
| 4 | + stage = "identity" |
| 5 | + accounts_enabled = "${var.accounts_enabled}" |
| 6 | + account_email = "${var.account_email}" |
| 7 | + account_iam_user_access_to_billing = "${var.account_iam_user_access_to_billing}" |
| 8 | + account_role_name = "${var.account_role_name}" |
42 | 9 | } |
43 | 10 |
|
44 | 11 | output "identity_account_arn" { |
45 | | - value = "${local.identity_account_arn}" |
| 12 | + value = "${module.identity.account_arn}" |
46 | 13 | } |
47 | 14 |
|
48 | 15 | output "identity_account_id" { |
49 | | - value = "${local.identity_account_id}" |
| 16 | + value = "${module.identity.account_id}" |
50 | 17 | } |
51 | 18 |
|
52 | 19 | output "identity_organization_account_access_role" { |
53 | | - value = "${local.identity_organization_account_access_role}" |
| 20 | + value = "${module.identity.organization_account_access_role}" |
54 | 21 | } |
0 commit comments