Skip to content

nclouds/terraform-aws-cloudwatch

Repository files navigation

Terraform

nCode Library

AWS Cloudwatch (Log Group) Terraform Module

Terraform module to provision Cloudwatch Log Group on AWS.

Usage

Setup

Create a Cloudwatch Log Group.

    module "log_group" {
        source              = "github.com/nclouds/terraform-aws-cloudwatch?ref=v0.1.19"
        identifier          = "example"
        retention_in_days   = 7
        tags                = {
            Owner           = "sysops"
            env             = "dev"
            Cost_Center     = "XYZ"
        }
    }

Examples

Here are some working examples of using this module:

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
aws n/a

Modules

Name Source Version
common_tags github.com/nclouds/terraform-aws-common-tags?ref=v0.1.2
kms github.com/nclouds/terraform-aws-kms?ref=v0.1.5

Resources

Name Type
aws_cloudwatch_log_group.this resource
aws_caller_identity.current data source
aws_iam_policy_document.cloudwatch_logs data source
aws_iam_policy_document.combined data source
aws_iam_policy_document.kms_owner data source
aws_region.current data source

Inputs

Name Description Type Default Required
append_workspace Appends the terraform workspace at the end of resource names, - bool true no
identifier The name of the log group string "test" no
kms_key_id The ARN of the KMS Key to use when encrypting log data string null no
retention_in_days Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. number 30 no
tags Tags to be applied to the resource map(any) {} no
use_custom_kms_key Set to 'true' if you are passing a custom KMS Key ARN bool false no
use_name_prefix Allow terraform to append a unique string at the end of resource names bool true no

Outputs

Name Description
output n/a

Contributing

If you want to contribute to this repository check all the guidelines specified here before submitting a new PR.