Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

log-forwarder

Introduction

This Terraform sub-module manages rhcs_log_forwarder resources for ROSA HCP clusters. It configures forwarding of cluster logs to either Amazon S3 or Amazon CloudWatch (not both), and selects which applications and/or log forwarder groups to include.

Provider note: Use a terraform-redhat/rhcs release that includes the rhcs_log_forwarder resource (see provider changelog). The module constraint >= 1.7.2 matches other submodules; bump the submodule versions.tf once the minimum released version that ships this resource is known.

Tests

From this directory (modules/log-forwarder), run:

terraform init -backend=false
terraform test

tests/log_forwarder.tftest.hcl uses a mocked rhcs provider and covers the module preconditions (exactly one of s3 / cloudwatch, non-empty applications or groups) plus successful plan cases.

Example Usage

module "cluster_logs_s3" {
  source = "terraform-redhat/rosa-hcp/rhcs//modules/log-forwarder"
  version = "1.7.2"

  cluster_id = module.hcp.cluster_id

  s3 = {
    bucket_name   = "my-cluster-logs"
    bucket_prefix = "rosa-hcp/"
  }

  applications = ["my-app"]
}
module "cluster_logs_cloudwatch" {
  source = "terraform-redhat/rosa-hcp/rhcs//modules/log-forwarder"
  version = "1.7.2"

  cluster_id = module.hcp.cluster_id

  cloudwatch = {
    log_group_name            = "/rosa/hcp/cluster"
    log_distribution_role_arn = "arn:aws:iam::123456789012:role/LogDistributionRole"
  }

  groups = [
    { id = "audit", version = "1.0" }
  ]
}

Requirements

Name Version
terraform >= 1.0
rhcs >= 1.7.2

Providers

Name Version
rhcs >= 1.7.2

Modules

No modules.

Resources

Name Type
rhcs_log_forwarder.this resource

Inputs

Name Description Type Default Required
applications List of additional applications to forward logs for. At least one of applications or groups must be non-empty (provider requirement). list(string) null no
cloudwatch CloudWatch destination for log forwarding. Mutually exclusive with s3. See rhcs_log_forwarder resource documentation.
object({
log_group_name = string
log_distribution_role_arn = string
})
null no
cluster_id Identifier of the cluster. string n/a yes
groups List of log forwarder groups. At least one of applications or groups must be non-empty (provider requirement).
list(object({
id = string
version = optional(string)
}))
null no
s3 S3 destination for log forwarding. Mutually exclusive with cloudwatch. See rhcs_log_forwarder resource documentation.
object({
bucket_name = string
bucket_prefix = optional(string)
})
null no

Outputs

Name Description
id Unique identifier of the log forwarder.