Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.103.0
rev: v1.104.0
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ No modules.
|------|-------------|
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_replica_arns"></a> [dynamodb\_table\_replica\_arns](#output\_dynamodb\_table\_replica\_arns) | Map of the Table replicas ARNs |
| <a name="output_dynamodb_table_replica_stream_arns"></a> [dynamodb\_table\_replica\_stream\_arns](#output\_dynamodb\_table\_replica\_stream\_arns) | Map of the Table replicas stream ARNs |
| <a name="output_dynamodb_table_replica_stream_labels"></a> [dynamodb\_table\_replica\_stream\_labels](#output\_dynamodb\_table\_replica\_stream\_labels) | Map of the timestamps of the Table replicas stream |
| <a name="output_dynamodb_table_replicas"></a> [dynamodb\_table\_replicas](#output\_dynamodb\_table\_replicas) | Map of Table replicas by region |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream |
<!-- END_TF_DOCS -->

## Authors
Expand Down
8 changes: 6 additions & 2 deletions examples/autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ No inputs.
|------|-------------|
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_replica_arns"></a> [dynamodb\_table\_replica\_arns](#output\_dynamodb\_table\_replica\_arns) | Map of the Table replicas ARNs |
| <a name="output_dynamodb_table_replica_stream_arns"></a> [dynamodb\_table\_replica\_stream\_arns](#output\_dynamodb\_table\_replica\_stream\_arns) | Map of the Table replicas stream ARNs |
| <a name="output_dynamodb_table_replica_stream_labels"></a> [dynamodb\_table\_replica\_stream\_labels](#output\_dynamodb\_table\_replica\_stream\_labels) | Map of the timestamps of the Table replicas stream |
| <a name="output_dynamodb_table_replicas"></a> [dynamodb\_table\_replicas](#output\_dynamodb\_table\_replicas) | Map of Table replicas by region |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream |
<!-- END_TF_DOCS -->
24 changes: 22 additions & 2 deletions examples/autoscaling/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,31 @@ output "dynamodb_table_id" {
}

output "dynamodb_table_stream_arn" {
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
description = "The ARN of the Table Stream"
value = module.dynamodb_table.dynamodb_table_stream_arn
}

output "dynamodb_table_stream_label" {
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
description = "A timestamp, in ISO 8601 format of the Table Stream"
value = module.dynamodb_table.dynamodb_table_stream_label
}

output "dynamodb_table_replicas" {
description = "Map of Table replicas by region"
value = module.dynamodb_table.dynamodb_table_replicas
}

output "dynamodb_table_replica_arns" {
description = "Map of the Table replicas ARNs"
value = module.dynamodb_table.dynamodb_table_replica_arns
}

output "dynamodb_table_replica_stream_arns" {
description = "Map of the Table replicas stream ARNs"
value = module.dynamodb_table.dynamodb_table_replica_stream_arns
}

output "dynamodb_table_replica_stream_labels" {
description = "Map of the timestamps of the Table replicas stream"
value = module.dynamodb_table.dynamodb_table_replica_stream_labels
}
8 changes: 6 additions & 2 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ No inputs.
|------|-------------|
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_replica_arns"></a> [dynamodb\_table\_replica\_arns](#output\_dynamodb\_table\_replica\_arns) | Map of the Table replicas ARNs |
| <a name="output_dynamodb_table_replica_stream_arns"></a> [dynamodb\_table\_replica\_stream\_arns](#output\_dynamodb\_table\_replica\_stream\_arns) | Map of the Table replicas stream ARNs |
| <a name="output_dynamodb_table_replica_stream_labels"></a> [dynamodb\_table\_replica\_stream\_labels](#output\_dynamodb\_table\_replica\_stream\_labels) | Map of the timestamps of the Table replicas stream |
| <a name="output_dynamodb_table_replicas"></a> [dynamodb\_table\_replicas](#output\_dynamodb\_table\_replicas) | Map of Table replicas by region |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream |
<!-- END_TF_DOCS -->
24 changes: 22 additions & 2 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,31 @@ output "dynamodb_table_id" {
}

output "dynamodb_table_stream_arn" {
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
description = "The ARN of the Table Stream"
value = module.dynamodb_table.dynamodb_table_stream_arn
}

output "dynamodb_table_stream_label" {
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
description = "A timestamp, in ISO 8601 format of the Table Stream"
value = module.dynamodb_table.dynamodb_table_stream_label
}

output "dynamodb_table_replicas" {
description = "Map of Table replicas by region"
value = module.dynamodb_table.dynamodb_table_replicas
}

output "dynamodb_table_replica_arns" {
description = "Map of the Table replicas ARNs"
value = module.dynamodb_table.dynamodb_table_replica_arns
}

output "dynamodb_table_replica_stream_arns" {
description = "Map of the Table replicas stream ARNs"
value = module.dynamodb_table.dynamodb_table_replica_stream_arns
}

output "dynamodb_table_replica_stream_labels" {
description = "Map of the timestamps of the Table replicas stream"
value = module.dynamodb_table.dynamodb_table_replica_stream_labels
}
9 changes: 6 additions & 3 deletions examples/global-tables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.22 |
| <a name="provider_aws.euwest2"></a> [aws.euwest2](#provider\_aws.euwest2) | >= 6.22 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |

## Modules
Expand All @@ -55,6 +54,10 @@ No inputs.
|------|-------------|
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
| <a name="output_dynamodb_table_replica_arns"></a> [dynamodb\_table\_replica\_arns](#output\_dynamodb\_table\_replica\_arns) | Map of the Table replicas ARNs |
| <a name="output_dynamodb_table_replica_stream_arns"></a> [dynamodb\_table\_replica\_stream\_arns](#output\_dynamodb\_table\_replica\_stream\_arns) | Map of the Table replicas stream ARNs |
| <a name="output_dynamodb_table_replica_stream_labels"></a> [dynamodb\_table\_replica\_stream\_labels](#output\_dynamodb\_table\_replica\_stream\_labels) | Map of the timestamps of the Table replicas stream |
| <a name="output_dynamodb_table_replicas"></a> [dynamodb\_table\_replicas](#output\_dynamodb\_table\_replicas) | Map of Table replicas by region |
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream |
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream |
<!-- END_TF_DOCS -->
18 changes: 7 additions & 11 deletions examples/global-tables/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ provider "aws" {
region = "eu-west-1"
}

provider "aws" {
alias = "euwest2"
region = "eu-west-2"
}

locals {
tags = {
Terraform = "true"
Expand All @@ -23,12 +18,14 @@ resource "random_pet" "this" {
}

resource "aws_kms_key" "primary" {
region = "eu-west-1"

description = "CMK for primary region"
tags = local.tags
}

resource "aws_kms_key" "secondary" {
provider = aws.euwest2
region = "us-east-1"

description = "CMK for secondary region"
tags = local.tags
Expand Down Expand Up @@ -76,11 +73,10 @@ module "dynamodb_table" {
]

replica_regions = [{
region_name = "eu-west-2"
kms_key_arn = aws_kms_key.secondary.arn
propagate_tags = true
point_in_time_recovery = true
deletion_protection_enabled = false
region_name = "us-east-1"
kms_key_arn = aws_kms_key.secondary.arn
propagate_tags = true
point_in_time_recovery = true
}]

tags = local.tags
Expand Down
24 changes: 22 additions & 2 deletions examples/global-tables/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,31 @@ output "dynamodb_table_id" {
}

output "dynamodb_table_stream_arn" {
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
description = "The ARN of the Table Stream"
value = module.dynamodb_table.dynamodb_table_stream_arn
}

output "dynamodb_table_stream_label" {
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
description = "A timestamp, in ISO 8601 format of the Table Stream"
value = module.dynamodb_table.dynamodb_table_stream_label
}

output "dynamodb_table_replicas" {
description = "Map of Table replicas by region"
value = module.dynamodb_table.dynamodb_table_replicas
}

output "dynamodb_table_replica_arns" {
description = "Map of the Table replicas ARNs"
value = module.dynamodb_table.dynamodb_table_replica_arns
}

output "dynamodb_table_replica_stream_arns" {
description = "Map of the Table replicas stream ARNs"
value = module.dynamodb_table.dynamodb_table_replica_stream_arns
}

output "dynamodb_table_replica_stream_labels" {
description = "Map of the timestamps of the Table replicas stream"
value = module.dynamodb_table.dynamodb_table_replica_stream_labels
}
6 changes: 3 additions & 3 deletions examples/s3-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Note that this example may create resources which can cost money (AWS Elastic IP
|------|--------|---------|
| <a name="module_import_csv_table"></a> [import\_csv\_table](#module\_import\_csv\_table) | ../../ | n/a |
| <a name="module_import_json_table"></a> [import\_json\_table](#module\_import\_json\_table) | ../../ | n/a |
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.15 |
| <a name="module_s3_import_object_csv"></a> [s3\_import\_object\_csv](#module\_s3\_import\_object\_csv) | terraform-aws-modules/s3-bucket/aws//modules/object | ~> 3.15 |
| <a name="module_s3_import_object_json"></a> [s3\_import\_object\_json](#module\_s3\_import\_object\_json) | terraform-aws-modules/s3-bucket/aws//modules/object | ~> 3.15 |
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | >= 3.15 |
| <a name="module_s3_import_object_csv"></a> [s3\_import\_object\_csv](#module\_s3\_import\_object\_csv) | terraform-aws-modules/s3-bucket/aws//modules/object | >= 3.15 |
| <a name="module_s3_import_object_json"></a> [s3\_import\_object\_json](#module\_s3\_import\_object\_json) | terraform-aws-modules/s3-bucket/aws//modules/object | >= 3.15 |

## Resources

Expand Down
6 changes: 3 additions & 3 deletions examples/s3-import/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module "import_csv_table" {

module "s3_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "~> 3.15"
version = ">= 3.15"

bucket = "import-example-${random_pet.this.id}"

Expand All @@ -88,7 +88,7 @@ module "s3_bucket" {

module "s3_import_object_json" {
source = "terraform-aws-modules/s3-bucket/aws//modules/object"
version = "~> 3.15"
version = ">= 3.15"

bucket = module.s3_bucket.s3_bucket_id
key = "import-json-${random_pet.this.id}/sample.json"
Expand All @@ -98,7 +98,7 @@ module "s3_import_object_json" {

module "s3_import_object_csv" {
source = "terraform-aws-modules/s3-bucket/aws//modules/object"
version = "~> 3.15"
version = ">= 3.15"

bucket = module.s3_bucket.s3_bucket_id
key = "import-csv-${random_pet.this.id}/sample.csv"
Expand Down
35 changes: 31 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
locals {
replicas = { for v in try(aws_dynamodb_table.this[0].replica[*], aws_dynamodb_table.autoscaled[0].replica[*], aws_dynamodb_table.autoscaled_gsi_ignore[0].replica[*], []) : v.region_name => v }
replica_arns = { for v in local.replicas : v.region_name => v.arn }
replica_stream_arns = { for v in local.replicas : v.region_name => v.stream_arn }
replica_stream_labels = { for v in local.replicas : v.region_name => v.stream_label }
}

output "dynamodb_table_arn" {
description = "ARN of the DynamoDB table"
value = local.dynamodb_table_arn
Expand All @@ -9,11 +16,31 @@ output "dynamodb_table_id" {
}

output "dynamodb_table_stream_arn" {
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
value = var.stream_enabled ? try(aws_dynamodb_table.this[0].stream_arn, aws_dynamodb_table.autoscaled[0].stream_arn, aws_dynamodb_table.autoscaled_gsi_ignore[0].stream_arn, "") : null
description = "The ARN of the Table Stream"
value = try(aws_dynamodb_table.this[0].stream_arn, aws_dynamodb_table.autoscaled[0].stream_arn, aws_dynamodb_table.autoscaled_gsi_ignore[0].stream_arn, "")
}

output "dynamodb_table_stream_label" {
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
value = var.stream_enabled ? try(aws_dynamodb_table.this[0].stream_label, aws_dynamodb_table.autoscaled[0].stream_label, aws_dynamodb_table.autoscaled_gsi_ignore[0].stream_label, "") : null
description = "A timestamp, in ISO 8601 format of the Table Stream"
value = try(aws_dynamodb_table.this[0].stream_label, aws_dynamodb_table.autoscaled[0].stream_label, aws_dynamodb_table.autoscaled_gsi_ignore[0].stream_label, "")
}

output "dynamodb_table_replicas" {
description = "Map of Table replicas by region"
value = local.replicas
}

output "dynamodb_table_replica_arns" {
description = "Map of the Table replicas ARNs"
value = local.replica_arns
}

output "dynamodb_table_replica_stream_arns" {
description = "Map of the Table replicas stream ARNs"
value = local.replica_stream_arns
}

output "dynamodb_table_replica_stream_labels" {
description = "Map of the timestamps of the Table replicas stream"
value = local.replica_stream_labels
}