Skip to content

Commit

Permalink
Add log_delivery_configuration (#168)
Browse files Browse the repository at this point in the history
* Add log_delivery

Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>
  • Loading branch information
nitrocode and cloudpossebot authored Jun 14, 2022
1 parent 23557c5 commit a580353
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
":preserveSemverRanges"
],
"labels": ["auto-update"],
"dependencyDashboardAutoclose": true,
"enabledManagers": ["terraform"],
"terraform": {
"ignorePaths": ["**/context.tf", "examples/**"]
}
}

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ Available targets:
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.18 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.26 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.18 |

## Modules

Expand Down Expand Up @@ -285,6 +285,7 @@ Available targets:
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
| <a name="input_label_value_case"></a> [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,<br>set as tag values, and output by this module individually.<br>Does not affect values of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.<br>Default value: `lower`. | `string` | `null` | no |
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
| <a name="input_log_delivery_configuration"></a> [log\_delivery\_configuration](#input\_log\_delivery\_configuration) | The log\_delivery\_configuration block allows the streaming of Redis SLOWLOG or Redis Engine Log to CloudWatch Logs or Kinesis Data Firehose. Max of 2 blocks. | `list(map(any))` | `[]` | no |
| <a name="input_maintenance_window"></a> [maintenance\_window](#input\_maintenance\_window) | Maintenance window | `string` | `"wed:03:00-wed:04:00"` | no |
| <a name="input_multi_az_enabled"></a> [multi\_az\_enabled](#input\_multi\_az\_enabled) | Multi AZ (Automatic Failover must also be enabled. If Cluster Mode is enabled, Multi AZ is on by default, and this setting is ignored) | `bool` | `false` | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
Expand Down
5 changes: 3 additions & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.26 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.18 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.26 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.18 |

## Modules

Expand Down Expand Up @@ -75,6 +75,7 @@
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
| <a name="input_label_value_case"></a> [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,<br>set as tag values, and output by this module individually.<br>Does not affect values of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.<br>Default value: `lower`. | `string` | `null` | no |
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
| <a name="input_log_delivery_configuration"></a> [log\_delivery\_configuration](#input\_log\_delivery\_configuration) | The log\_delivery\_configuration block allows the streaming of Redis SLOWLOG or Redis Engine Log to CloudWatch Logs or Kinesis Data Firehose. Max of 2 blocks. | `list(map(any))` | `[]` | no |
| <a name="input_maintenance_window"></a> [maintenance\_window](#input\_maintenance\_window) | Maintenance window | `string` | `"wed:03:00-wed:04:00"` | no |
| <a name="input_multi_az_enabled"></a> [multi\_az\_enabled](#input\_multi\_az\_enabled) | Multi AZ (Automatic Failover must also be enabled. If Cluster Mode is enabled, Multi AZ is on by default, and this setting is ignored) | `bool` | `false` | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
Expand Down
16 changes: 16 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ resource "aws_route53_zone" "private" {
}
}

module "cloudwatch_logs" {
source = "cloudposse/cloudwatch-logs/aws"
version = "0.6.5"

context = module.this.context
}

module "redis" {
source = "../../"

Expand Down Expand Up @@ -65,5 +72,14 @@ module "redis" {

security_group_delete_timeout = "5m"

log_delivery_configuration = [
{
destination = module.cloudwatch_logs.log_group_name
destination_type = "cloudwatch-logs"
log_format = "json"
log_type = "engine-log"
}
]

context = module.this.context
}
8 changes: 2 additions & 6 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
terraform {
required_version = ">= 0.13.0"
required_version = ">= 0.14.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 2.0"
}
null = {
source = "hashicorp/null"
version = ">= 2.0"
version = ">= 4.18"
}
}
}
12 changes: 11 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ resource "aws_elasticache_parameter_group" "default" {
}
}


tags = module.this.tags

# Ignore changes to the description since it will try to recreate the resource
Expand Down Expand Up @@ -144,6 +143,17 @@ resource "aws_elasticache_replication_group" "default" {
final_snapshot_identifier = var.final_snapshot_identifier
apply_immediately = var.apply_immediately

dynamic "log_delivery_configuration" {
for_each = var.log_delivery_configuration

content {
destination = lookup(log_delivery_configuration.value, "destination", null)
destination_type = lookup(log_delivery_configuration.value, "destination_type", null)
log_format = lookup(log_delivery_configuration.value, "log_format", null)
log_type = lookup(log_delivery_configuration.value, "log_type", null)
}
}

tags = module.this.tags

num_node_groups = var.cluster_mode_enabled ? var.cluster_mode_num_node_groups : null
Expand Down
10 changes: 7 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


variable "vpc_id" {
type = string
description = "VPC ID"
Expand Down Expand Up @@ -225,4 +223,10 @@ variable "parameter_group_description" {
type = string
default = null
description = "Managed by Terraform"
}
}

variable "log_delivery_configuration" {
type = list(map(any))
default = []
description = "The log_delivery_configuration block allows the streaming of Redis SLOWLOG or Redis Engine Log to CloudWatch Logs or Kinesis Data Firehose. Max of 2 blocks."
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.26"
version = ">= 4.18"
}
}
}

0 comments on commit a580353

Please sign in to comment.