Skip to content

Commit 6ed0098

Browse files
authored
Correct cloudtrail Account-Map Reference (#673)
1 parent 1caab1c commit 6ed0098

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

modules/cloudtrail/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ components:
4545
4646
| Name | Source | Version |
4747
|------|--------|---------|
48+
| <a name="module_account_map"></a> [account\_map](#module\_account\_map) | cloudposse/stack-config/yaml//modules/remote-state | 1.4.2 |
4849
| <a name="module_cloudtrail"></a> [cloudtrail](#module\_cloudtrail) | cloudposse/cloudtrail/aws | 0.21.0 |
49-
| <a name="module_cloudtrail_bucket"></a> [cloudtrail\_bucket](#module\_cloudtrail\_bucket) | cloudposse/stack-config/yaml//modules/remote-state | 1.4.1 |
50+
| <a name="module_cloudtrail_bucket"></a> [cloudtrail\_bucket](#module\_cloudtrail\_bucket) | cloudposse/stack-config/yaml//modules/remote-state | 1.4.2 |
5051
| <a name="module_iam_roles"></a> [iam\_roles](#module\_iam\_roles) | ../account-map/modules/iam-roles | n/a |
5152
| <a name="module_kms_key_cloudtrail"></a> [kms\_key\_cloudtrail](#module\_kms\_key\_cloudtrail) | cloudposse/kms-key/aws | 0.12.1 |
5253
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
@@ -72,7 +73,6 @@ components:
7273
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
7374
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
7475
| <a name="input_audit_access_enabled"></a> [audit\_access\_enabled](#input\_audit\_access\_enabled) | If `true`, allows the Audit account access to read Cloudtrail logs directly from S3. This is a requirement for running Athena queries in the Audit account. | `bool` | `false` | no |
75-
| <a name="input_audit_account_name"></a> [audit\_account\_name](#input\_audit\_account\_name) | The key used in Account Map to find the Audit account | `string` | `"core-audit"` | no |
7676
| <a name="input_cloudtrail_bucket_component_name"></a> [cloudtrail\_bucket\_component\_name](#input\_cloudtrail\_bucket\_component\_name) | The name of the CloudTrail bucket component | `string` | `"cloudtrail-bucket"` | no |
7777
| <a name="input_cloudtrail_bucket_environment_name"></a> [cloudtrail\_bucket\_environment\_name](#input\_cloudtrail\_bucket\_environment\_name) | The name of the environment where the CloudTrail bucket is provisioned | `string` | n/a | yes |
7878
| <a name="input_cloudtrail_bucket_stage_name"></a> [cloudtrail\_bucket\_stage\_name](#input\_cloudtrail\_bucket\_stage\_name) | The stage name where the CloudTrail bucket is provisioned | `string` | n/a | yes |

modules/cloudtrail/cloudtrail-kms-key.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
22
audit_access_enabled = module.this.enabled && var.audit_access_enabled
3-
audit_account_id = module.account_map.outputs.full_account_map[var.audit_account_name]
3+
audit_account_id = module.account_map.outputs.full_account_map[module.account_map.outputs.audit_account_account_name]
44
}
55

66
module "kms_key_cloudtrail" {

modules/cloudtrail/remote-state.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
module "cloudtrail_bucket" {
22
source = "cloudposse/stack-config/yaml//modules/remote-state"
3-
version = "1.4.1"
3+
version = "1.4.2"
44

55
component = var.cloudtrail_bucket_component_name
66
environment = var.cloudtrail_bucket_environment_name
77
stage = var.cloudtrail_bucket_stage_name
88

99
context = module.this.context
1010
}
11+
12+
module "account_map" {
13+
source = "cloudposse/stack-config/yaml//modules/remote-state"
14+
version = "1.4.2"
15+
16+
component = "account-map"
17+
tenant = module.iam_roles.global_tenant_name
18+
environment = module.iam_roles.global_environment_name
19+
stage = module.iam_roles.global_stage_name
20+
21+
context = module.this.context
22+
}

modules/cloudtrail/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,3 @@ variable "audit_access_enabled" {
7171
default = false
7272
description = "If `true`, allows the Audit account access to read Cloudtrail logs directly from S3. This is a requirement for running Athena queries in the Audit account."
7373
}
74-
75-
variable "audit_account_name" {
76-
type = string
77-
default = "core-audit"
78-
description = "The key used in Account Map to find the Audit account"
79-
}

modules/eks/cluster/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ locals {
2121
rolearn = module.iam_arns.principals_map[local.identity_account_name][role.aws_team]
2222
# Include session name in the username for auditing purposes.
2323
# See https://aws.github.io/aws-eks-best-practices/security/docs/iam/#use-iam-roles-when-multiple-users-need-identical-access-to-the-cluster
24-
username = format("%s-%s::{{SessionName}}", local.identity_account_name, role.aws_team)
24+
username = format("%s-%s", local.identity_account_name, role.aws_team)
2525
groups = role.groups
2626
}]
2727

0 commit comments

Comments
 (0)