Skip to content

Commit

Permalink
Feat support create log (#7)
Browse files Browse the repository at this point in the history
* (feat) support create log group

* (docs) update change log
  • Loading branch information
waruwat-dev authored Oct 7, 2022
1 parent f619e4f commit 52c41a4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
8 changes: 6 additions & 2 deletions CHANGLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@

All notable changes to this module will be documented in this file.

## [1.0.2] - 2022-05-18
## [1.0.3] - 2022-10-07

### Added

- support create log group by terraform

## [1.0.2] - 2022-05-18

### Updated

- fix: resources naming and add compatible for create parameter

## [1.0.1] - 2022-04-29


### Added

- add support for mysql and serverless
Expand Down
11 changes: 7 additions & 4 deletions examples/mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ module "vpc" {
module "aurora" {
source = "../.."

name = local.name
environment = "test"
name = local.name
prefix = "oozou"
environment = "test"

engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.03.2"
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.10.2"

is_instances_use_identifier_prefix = true
instances = {
Expand Down Expand Up @@ -104,6 +105,8 @@ module "aurora" {

}

performance_insights_enabled = true

is_storage_encrypted = true
kms_key_id = null

Expand Down
8 changes: 8 additions & 0 deletions log.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "aws_cloudwatch_log_group" "this" {
count = var.is_create_cluster ? length(var.enabled_cloudwatch_logs_exports) : 0
name = format("/aws/rds/cluster/%s-cluster/%s", local.name, var.enabled_cloudwatch_logs_exports[count.index])
retention_in_days = var.cloudwatch_log_retention_in_days
kms_key_id = var.cloudwatch_log_kms_key_id

tags = local.tags
}
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ resource "aws_rds_cluster" "this" {

tags = merge(local.tags, { "Name" : "${var.database_name}" })
copy_tags_to_snapshot = var.is_copy_tags_to_snapshot
depends_on = [
aws_cloudwatch_log_group.this
]
}

/* -------------------------------------------------------------------------- */
Expand Down
16 changes: 16 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,19 @@ variable "db_cluster_parameters" {
}))
default = []
}

/* -------------------------------------------------------------------------- */
/* CLOUD WATCH */
/* -------------------------------------------------------------------------- */

variable "cloudwatch_log_retention_in_days" {
description = "Specifies the number of days you want to retain log events Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653, and 0. If you select 0, the events in the log group are always retained and never expire"
type = number
default = 90
}

variable "cloudwatch_log_kms_key_id" {
description = "The ARN for the KMS encryption key."
type = string
default = null
}

0 comments on commit 52c41a4

Please sign in to comment.