diff --git a/README.md b/README.md index 5503a45..8ff080d 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This repo list some open to use Terraform modules we use at `Peak AI` because we - [:camera: ECR](/ecr) - [☸ K8S_IRSA](/k8s_irsa) - [:open_file_folder: S3](/s3) +- [:oil_drum: Dax](/dax) - [:bookmark: Tags (aka Labels)](/tags) ## Example usage diff --git a/dax/README.md b/dax/README.md new file mode 100644 index 0000000..c2c90f5 --- /dev/null +++ b/dax/README.md @@ -0,0 +1,61 @@ +## Requirements + +No requirements. + +## Providers + +| Name | Version | +|------|---------| +| aws | >= 2.62 | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| item\_cache\_ttl\_milli\_second | Time after which item cache will invalidate. Default 5 minutes | `number` | `300000` | no | +| name | n/a | `string` | n/a | yes | +| node\_type | (Required) The compute and memory capacity of the nodes | `string` | `"dax.t2.small"` | no | +| query\_cache\_ttl\_\_milli\_second | Time after which item query will invalidate. Default 5 minutes | `number` | `300000` | no | +| region | n/a | `string` | n/a | yes | +| replication\_factor | (Required) The number of nodes in the DAX cluster | `number` | `3` | no | +| tables | List of tables for using dax | `list(string)` | n/a | yes | +| tags | A map of tags to assign to the resource | `any` | n/a | yes | +| vpc\_id | n/a | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| endpoint\_created | Endpoint of the created cluster. | + +## Example usage + +```hcl +provider "aws" { + version = "~> 2.62" +} + +module "tags" { + source = "git::https://github.com/peak-ai/terraform-modules.git//tags?ref=v0.7.0" + tenant = "new-client" + stage = "latest" + feature = "example" + service = "example" +} + +module "my_dax" { + source = "git::https://github.com/peak-ai/terraform-modules.git//dax?ref=v0.7.0" + name = "dax" + tags = module.tags.default + region = "example_region" + vpc_id = "example_vpc_id" + node_type = "dax.t2.small" + replication_factor = 3 + query_cache_ttl__milli_second = 30 * 1000 + item_cache_ttl_milli_second = 30 * 60 * 1000 + tables = [ + "table1", + "table2" + ] +} +``` diff --git a/dax/main.tf b/dax/main.tf new file mode 100644 index 0000000..d61906f --- /dev/null +++ b/dax/main.tf @@ -0,0 +1,102 @@ +provider "aws" { + region = var.region + default_tags { + tags = var.tags + } +} + +data "aws_caller_identity" "current" {} +resource "aws_iam_role" "role" { + name = "${var.name}-dax" + + assume_role_policy = <