diff --git a/infrastructure/terraform/modules/amp_branch/README.md b/infrastructure/terraform/modules/amp_branch/README.md index d6598290..e1a8c7c6 100644 --- a/infrastructure/terraform/modules/amp_branch/README.md +++ b/infrastructure/terraform/modules/amp_branch/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [amplify\_app\_id](#input\_amplify\_app\_id) | Amplify application ID | `string` | n/a | yes | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [branch](#input\_branch) | The name of the branch being deployed | `string` | n/a | yes | @@ -34,7 +34,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [name](#output\_name) | Name of the Amplify branch | diff --git a/infrastructure/terraform/modules/apim-authentication/README.md b/infrastructure/terraform/modules/apim-authentication/README.md index 95a07bc2..9e02c271 100644 --- a/infrastructure/terraform/modules/apim-authentication/README.md +++ b/infrastructure/terraform/modules/apim-authentication/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [acct\_s3\_buckets](#input\_acct\_s3\_buckets) | Account S3 buckets | `map(any)` | n/a | yes | | [apim\_auth\_token\_schedule](#input\_apim\_auth\_token\_schedule) | Schedule to renew the APIM auth token | `string` | `"rate(9 minutes)"` | no | | [apim\_auth\_token\_url](#input\_apim\_auth\_token\_url) | URL to generate an APIM auth token | `string` | n/a | yes | @@ -41,7 +41,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [apim\_access\_token\_ssm\_parameter](#output\_apim\_access\_token\_ssm\_parameter) | APIM Access Token SSM parameter details | diff --git a/infrastructure/terraform/modules/aws-backup-source/README.md b/infrastructure/terraform/modules/aws-backup-source/README.md index 11cccdff..aa03b35a 100644 --- a/infrastructure/terraform/modules/aws-backup-source/README.md +++ b/infrastructure/terraform/modules/aws-backup-source/README.md @@ -55,7 +55,7 @@ No requirements. ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [backup\_copy\_vault\_account\_id](#input\_backup\_copy\_vault\_account\_id) | The account id of the destination backup vault for allowing restores back into the source account. | `string` | `""` | no | | [backup\_copy\_vault\_arn](#input\_backup\_copy\_vault\_arn) | The ARN of the destination backup vault for cross-account backup copies. | `string` | `""` | no | | [backup\_plan\_config\_dynamodb](#input\_backup\_plan\_config\_dynamodb) | Configuration for backup plans with dynamodb |
object({
enable = bool
selection_tag = string
compliance_resource_types = list(string)
rules = optional(list(object({
name = string
schedule = string
enable_continuous_backup = optional(bool)
lifecycle = object({
delete_after = number
cold_storage_after = optional(number)
})
copy_action = optional(object({
delete_after = optional(number)
}))
})))
})
|
{
"compliance_resource_types": [
"DynamoDB"
],
"enable": false,
"rules": [
{
"copy_action": {
"delete_after": 365
},
"lifecycle": {
"delete_after": 35
},
"name": "dynamodb_daily_kept_5_weeks",
"schedule": "cron(0 0 * * ? *)"
},
{
"copy_action": {
"delete_after": 365
},
"lifecycle": {
"delete_after": 90
},
"name": "dynamodb_weekly_kept_3_months",
"schedule": "cron(0 1 ? * SUN *)"
},
{
"copy_action": {
"delete_after": 365
},
"lifecycle": {
"cold_storage_after": 30,
"delete_after": 2555
},
"name": "dynamodb_monthly_kept_7_years",
"schedule": "cron(0 2 1 * ? *)"
}
],
"selection_tag": "BackupDynamoDB"
}
| no | diff --git a/infrastructure/terraform/modules/eventpub/README.md b/infrastructure/terraform/modules/eventpub/README.md index dd6f2e41..8b7eee54 100644 --- a/infrastructure/terraform/modules/eventpub/README.md +++ b/infrastructure/terraform/modules/eventpub/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [access\_logging\_bucket](#input\_access\_logging\_bucket) | S3 Access logging bucket name. | `string` | `""` | no | | [additional\_policies\_for\_event\_cache\_bucket](#input\_additional\_policies\_for\_event\_cache\_bucket) | A list of JSON policies to use to build the bucket policy | `list(string)` | `[]` | no | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | @@ -45,7 +45,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [publishing\_anomaly\_alarm](#output\_publishing\_anomaly\_alarm) | CloudWatch anomaly detection alarm details for SNS publishing | | [s3\_bucket\_event\_cache](#output\_s3\_bucket\_event\_cache) | S3 Bucket ARN and Name for event cache | | [sns\_topic](#output\_sns\_topic) | SNS Topic ARN and Name | diff --git a/infrastructure/terraform/modules/eventsub/README.md b/infrastructure/terraform/modules/eventsub/README.md index 160a59d7..f9d812ab 100644 --- a/infrastructure/terraform/modules/eventsub/README.md +++ b/infrastructure/terraform/modules/eventsub/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [access\_logging\_bucket](#input\_access\_logging\_bucket) | Name of S3 bucket to use for access logging | `string` | `""` | no | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [component](#input\_component) | The name of the terraformscaffold component calling this module | `string` | n/a | yes | @@ -27,6 +27,7 @@ | [event\_anomaly\_period](#input\_event\_anomaly\_period) | The period in seconds over which the specified statistic is applied for anomaly detection. Minimum 300 seconds (5 minutes). Recommended: 300-600. | `number` | `300` | no | | [event\_cache\_buffer\_interval](#input\_event\_cache\_buffer\_interval) | The buffer interval for data firehose | `number` | `500` | no | | [event\_cache\_expiry\_days](#input\_event\_cache\_expiry\_days) | s3 archiving expiry in days | `number` | `30` | no | +| [eventsub\_shared\_account\_ids](#input\_eventsub\_shared\_account\_ids) | List of shared infra account IDs allowed to publish to the SNS topic. | `list(string)` | `[]` | no | | [force\_destroy](#input\_force\_destroy) | When enabled will force destroy event-cache S3 bucket | `bool` | `false` | no | | [glue\_role\_arn](#input\_glue\_role\_arn) | ARN of the Glue execution role from the parent | `string` | n/a | yes | | [group](#input\_group) | The name of the tfscaffold group | `string` | `null` | no | @@ -36,13 +37,12 @@ | [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes | | [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes | | [region](#input\_region) | The AWS Region | `string` | n/a | yes | -| [shared\_infra\_account\_id](#input\_shared\_infra\_account\_id) | The AWS Account ID of the shared infrastructure account | `string` | `"000000000000"` | no | | [sns\_success\_logging\_sample\_percent](#input\_sns\_success\_logging\_sample\_percent) | Enable SNS Delivery Successful Sample Percentage | `number` | `0` | no | ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [s3\_bucket\_event\_cache](#output\_s3\_bucket\_event\_cache) | S3 Bucket ARN and Name for event cache | | [sns\_topic](#output\_sns\_topic) | SNS Topic ARN and Name | diff --git a/infrastructure/terraform/modules/eventsub/sns_topic_policy.tf b/infrastructure/terraform/modules/eventsub/sns_topic_policy.tf index 6ccd8312..b3e50f10 100644 --- a/infrastructure/terraform/modules/eventsub/sns_topic_policy.tf +++ b/infrastructure/terraform/modules/eventsub/sns_topic_policy.tf @@ -42,22 +42,24 @@ data "aws_iam_policy_document" "sns_topic_policy" { } } - statement { - sid = "AllowAllSNSActionsFromSharedAccount" - effect = "Allow" - actions = [ - "SNS:Publish", - ] + dynamic "statement" { + for_each = length(var.eventsub_shared_account_ids) > 0 ? [1] : [] - principals { - type = "AWS" - identifiers = [ - "arn:aws:iam::${var.shared_infra_account_id}:root" + content { + sid = "AllowAllSNSActionsFromSharedAccount" + effect = "Allow" + actions = [ + "SNS:Publish", ] - } - resources = [ - aws_sns_topic.main.arn, - ] + principals { + type = "AWS" + identifiers = [for account_id in var.eventsub_shared_account_ids : "arn:aws:iam::${account_id}:root"] + } + + resources = [ + aws_sns_topic.main.arn, + ] + } } } diff --git a/infrastructure/terraform/modules/eventsub/variables.tf b/infrastructure/terraform/modules/eventsub/variables.tf index 964e90bd..baf34bd4 100644 --- a/infrastructure/terraform/modules/eventsub/variables.tf +++ b/infrastructure/terraform/modules/eventsub/variables.tf @@ -79,6 +79,12 @@ variable "sns_success_logging_sample_percent" { default = 0 } +variable "eventsub_shared_account_ids" { + type = list(string) + description = "List of shared infra account IDs allowed to publish to the SNS topic." + default = [] +} + ## # CloudWatch Anomaly Detection Variables ## @@ -142,12 +148,6 @@ variable "force_destroy" { default = false } -variable "shared_infra_account_id" { - type = string - description = "The AWS Account ID of the shared infrastructure account" - default = "000000000000" -} - variable "glue_role_arn" { type = string description = "ARN of the Glue execution role from the parent" diff --git a/infrastructure/terraform/modules/kms/README.md b/infrastructure/terraform/modules/kms/README.md index 88fb045d..3fd7173d 100644 --- a/infrastructure/terraform/modules/kms/README.md +++ b/infrastructure/terraform/modules/kms/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [alias](#input\_alias) | Alias name for the hieradata KMS key | `string` | n/a | yes | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [component](#input\_component) | The name of the terraformscaffold component calling this module | `string` | n/a | yes | @@ -29,7 +29,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [admin\_policy\_arn](#output\_admin\_policy\_arn) | ARN of the admin IAM policy | | [key\_arn](#output\_key\_arn) | ARN of the KMS key | | [key\_id](#output\_key\_id) | ID of the KMS key | diff --git a/infrastructure/terraform/modules/lambda/README.md b/infrastructure/terraform/modules/lambda/README.md index d99cb527..5f30a6d8 100644 --- a/infrastructure/terraform/modules/lambda/README.md +++ b/infrastructure/terraform/modules/lambda/README.md @@ -23,13 +23,13 @@ output "processor_lambda_error_rate_alarm_arn" { ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 0.12 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [application\_log\_level](#input\_application\_log\_level) | The detail level of the logs the application sends to CloudWatch | `string` | `"INFO"` | no | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [component](#input\_component) | The name of the tfscaffold component | `string` | n/a | yes | @@ -89,7 +89,7 @@ output "processor_lambda_error_rate_alarm_arn" { ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of the CloudWatch Log Group for the Lambda function | | [function\_arn](#output\_function\_arn) | ARN of the Lambda function | | [function\_env\_vars](#output\_function\_env\_vars) | Environment variables for the Lambda function | diff --git a/infrastructure/terraform/modules/obs-datasource/README.md b/infrastructure/terraform/modules/obs-datasource/README.md index fd7817e8..8b098374 100644 --- a/infrastructure/terraform/modules/obs-datasource/README.md +++ b/infrastructure/terraform/modules/obs-datasource/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [component](#input\_component) | The name of the terraformscaffold component calling this module | `string` | n/a | yes | | [default\_tags](#input\_default\_tags) | Default tag map for application to all taggable resources in the module | `map(string)` | `{}` | no | @@ -29,7 +29,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [log\_subscription\_role\_arn](#output\_log\_subscription\_role\_arn) | The ARN of the log subscription IAM role. | diff --git a/infrastructure/terraform/modules/s3bucket/README.md b/infrastructure/terraform/modules/s3bucket/README.md index c4748363..c596e573 100644 --- a/infrastructure/terraform/modules/s3bucket/README.md +++ b/infrastructure/terraform/modules/s3bucket/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [acl](#input\_acl) | ACL to set on the bucket. Defaults to private | `string` | `"private"` | no | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [bucket\_key\_enabled](#input\_bucket\_key\_enabled) | Boolean to toggle bucket key enablement | `bool` | `true` | no | @@ -37,7 +37,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [acl](#output\_acl) | The ACL of the S3 bucket. If the object ownership is set to 'BucketOwnerEnforced', the ACL will be 'private'. Otherwise, it will reflect the ACL set in the aws\_s3\_bucket\_acl resource. | | [arn](#output\_arn) | The ARN of the S3 bucket | | [bucket](#output\_bucket) | The name of the S3 bucket | diff --git a/infrastructure/terraform/modules/sqs/README.md b/infrastructure/terraform/modules/sqs/README.md index 263a6473..6a3b94b2 100644 --- a/infrastructure/terraform/modules/sqs/README.md +++ b/infrastructure/terraform/modules/sqs/README.md @@ -6,13 +6,13 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.9.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [allowed\_arns](#input\_allowed\_arns) | A list of AWS account IDs allowed to access this resource | `list(any)` | `null` | no | | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [component](#input\_component) | The name of the tfscaffold component | `string` | n/a | yes | @@ -42,7 +42,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [sqs\_dlq\_arn](#output\_sqs\_dlq\_arn) | The ARN of the SQS dead-letter queue | | [sqs\_dlq\_messages\_alarm\_arn](#output\_sqs\_dlq\_messages\_alarm\_arn) | The ARN of the CloudWatch alarm for messages in the SQS dead-letter queue | | [sqs\_dlq\_messages\_alarm\_name](#output\_sqs\_dlq\_messages\_alarm\_name) | The name of the CloudWatch alarm for messages in the SQS dead-letter queue | diff --git a/infrastructure/terraform/modules/ssl/README.md b/infrastructure/terraform/modules/ssl/README.md index 034c98b0..3d3a41d9 100644 --- a/infrastructure/terraform/modules/ssl/README.md +++ b/infrastructure/terraform/modules/ssl/README.md @@ -6,14 +6,14 @@ ## Requirements | Name | Version | -| ---- | ------- | +|------|---------| | [terraform](#requirement\_terraform) | >= 1.10.1 | | [tls](#requirement\_tls) | 4.1.0 | ## Inputs | Name | Description | Type | Default | Required | -| ---- | ----------- | ---- | ------- | :------: | +|------|-------------|------|---------|:--------:| | [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes | | [component](#input\_component) | The name of the tfscaffold component | `string` | n/a | yes | | [default\_tags](#input\_default\_tags) | A map of default tags to apply to all taggable resources within the component | `map(string)` | `{}` | no | @@ -31,7 +31,7 @@ ## Outputs | Name | Description | -| ---- | ----------- | +|------|-------------| | [cacert\_pem](#output\_cacert\_pem) | Truststore | | [server\_crt](#output\_server\_crt) | Server Certificate | | [server\_key](#output\_server\_key) | Server Key |