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.
From this directory (modules/log-forwarder), run:
terraform init -backend=false
terraform testtests/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.
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" }
]
}
| Name | Version |
|---|---|
| terraform | >= 1.0 |
| rhcs | >= 1.7.2 |
| Name | Version |
|---|---|
| rhcs | >= 1.7.2 |
No modules.
| Name | Type |
|---|---|
| rhcs_log_forwarder.this | resource |
| 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({ |
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({ |
null |
no |
| s3 | S3 destination for log forwarding. Mutually exclusive with cloudwatch. See rhcs_log_forwarder resource documentation. | object({ |
null |
no |
| Name | Description |
|---|---|
| id | Unique identifier of the log forwarder. |