Skip to content

Commit 41f7ee8

Browse files
feat: All variables that started with logdna_ have been renamed to start with log_analysis_.<br>* All variables that started with sysdig_ have been renamed to start with cloud_monitoring_. (#237)
1 parent 1a73943 commit 41f7ee8

File tree

9 files changed

+225
-186
lines changed

9 files changed

+225
-186
lines changed

.github/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ repository:
1919
# The description is displayed under the repository name on the
2020
# organization page and in the 'About' section of the repository.
2121

22-
description: "Deploys the LogDNA agent and SysDig agents to a cluster"
22+
description: "Deploys the Log Analysis agent and Cloud Monitoring agents to a cluster"
2323
topics: core-team, terraform, ibm-cloud, terraform-module, logdna, sysdig, monitoring-agent, logging-agent, observability-agent, supported, graduated

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ module "observability_agents" {
6464
# update this with the Id of your IBM Cloud resource group
6565
cluster_resource_group_id = "resource group id"
6666
# update these values with names and keys from the observability instances provisioning
67-
logdna_instance_name = "logdna instance name"
68-
logdna_ingestion_key = "logdna ingestion key"
69-
sysdig_instance_name = "sysdig name"
70-
sysdig_access_key = "sysdig access key"
67+
log_analysis_instance_name = "logdna instance name"
68+
log_analysis_ingestion_key = "logdna ingestion key"
69+
cloud_monitoring_instance_name = "sysdig name"
70+
cloud_monitoring_access_key = "sysdig access key"
7171
}
7272
```
7373

@@ -78,8 +78,8 @@ You can configure the logging agent to filter log lines according to the Kuberne
7878
For example, to set the agent to return all log lines coming from the `default` Kubernetes namespace and exclude anything with a label `app.kubernetes.io/name` with value `sample-app` or an annotation `annotation.user` with value `sample-user`, include these parameters:
7979

8080
```text
81-
custom_logdna_at_agent_line_exclusion = "label.app.kubernetes.io/name:sample-app\\, annotation.user:sample-user"
82-
custom_logdna_at_agent_line_inclusion = "namespace:default"
81+
custom_log_analysis_at_agent_line_exclusion = "label.app.kubernetes.io/name:sample-app\\, annotation.user:sample-user"
82+
custom_log_analysis_at_agent_line_inclusion = "namespace:default"
8383
```
8484

8585
The following is the corresponding DaemonSet configuration:
@@ -133,37 +133,37 @@ No modules.
133133

134134
| Name | Type |
135135
|------|------|
136-
| [helm_release.logdna_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
137-
| [helm_release.sysdig_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
136+
| [helm_release.cloud_monitoring_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
137+
| [helm_release.log_analysis_agent](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
138138
| [ibm_container_cluster_config.cluster_config](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_cluster_config) | data source |
139139
| [ibm_container_vpc_cluster.cluster](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/container_vpc_cluster) | data source |
140-
| [ibm_resource_instance.logdna_instance](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/resource_instance) | data source |
141-
| [ibm_resource_instance.sysdig_instance](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/resource_instance) | data source |
140+
| [ibm_resource_instance.cloud_monitoring_instance](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/resource_instance) | data source |
141+
| [ibm_resource_instance.log_analysis_instance](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/data-sources/resource_instance) | data source |
142142

143143
### Inputs
144144

145145
| Name | Description | Type | Default | Required |
146146
|------|-------------|------|---------|:--------:|
147+
| <a name="input_cloud_monitoring_access_key"></a> [cloud\_monitoring\_access\_key](#input\_cloud\_monitoring\_access\_key) | Access key used by the IBM Cloud Monitoring agent to communicate with the instance | `string` | `null` | no |
148+
| <a name="input_cloud_monitoring_add_cluster_name"></a> [cloud\_monitoring\_add\_cluster\_name](#input\_cloud\_monitoring\_add\_cluster\_name) | If true, configure the cloud monitoring agent to attach a tag containing the cluster name to all metric data. | `bool` | `true` | no |
149+
| <a name="input_cloud_monitoring_agent_tags"></a> [cloud\_monitoring\_agent\_tags](#input\_cloud\_monitoring\_agent\_tags) | array of tags to group the host metrics pushed by the cloud monitoring agent | `list(string)` | `[]` | no |
150+
| <a name="input_cloud_monitoring_agent_version"></a> [cloud\_monitoring\_agent\_version](#input\_cloud\_monitoring\_agent\_version) | IBM Cloud Monitoring Agent Version. To lookup version run: `ibmcloud cr images --restrict ext/sysdig/agent`. If null, the default value is used. | `string` | `"12.18.0"` | no |
151+
| <a name="input_cloud_monitoring_enabled"></a> [cloud\_monitoring\_enabled](#input\_cloud\_monitoring\_enabled) | Deploy IBM Cloud Monitoring agent | `bool` | `true` | no |
152+
| <a name="input_cloud_monitoring_instance_name"></a> [cloud\_monitoring\_instance\_name](#input\_cloud\_monitoring\_instance\_name) | The name of the IBM Cloud Monitoring instance to use. Required if Cloud Monitoring is enabled | `string` | `null` | no |
153+
| <a name="input_cloud_monitoring_metrics_filter"></a> [cloud\_monitoring\_metrics\_filter](#input\_cloud\_monitoring\_metrics\_filter) | To filter custom metrics, specify the Cloud Monitoring metrics to include or to exclude. See https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics. | <pre>list(object({<br> type = string<br> name = string<br> }))</pre> | `[]` | no |
154+
| <a name="input_cloud_monitoring_resource_group_id"></a> [cloud\_monitoring\_resource\_group\_id](#input\_cloud\_monitoring\_resource\_group\_id) | Resource group that the IBM Cloud Monitoring is in. Defaults to Clusters group | `string` | `null` | no |
147155
| <a name="input_cluster_config_endpoint_type"></a> [cluster\_config\_endpoint\_type](#input\_cluster\_config\_endpoint\_type) | Specify which type of endpoint to use for for cluster config access: 'default', 'private', 'vpe', 'link'. 'default' value will use the default endpoint of the cluster. | `string` | `"default"` | no |
148156
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | Cluster id to add to agents to | `string` | n/a | yes |
149157
| <a name="input_cluster_resource_group_id"></a> [cluster\_resource\_group\_id](#input\_cluster\_resource\_group\_id) | Resource group of the cluster | `string` | n/a | yes |
150-
| <a name="input_logdna_add_cluster_name"></a> [logdna\_add\_cluster\_name](#input\_logdna\_add\_cluster\_name) | If true, configure the logdna agent to attach a tag containing the cluster name to all log messages. | `bool` | `true` | no |
151-
| <a name="input_logdna_agent_custom_line_exclusion"></a> [logdna\_agent\_custom\_line\_exclusion](#input\_logdna\_agent\_custom\_line\_exclusion) | LogDNA agent custom configuration for line exclusion setting LOGDNA\_K8S\_METADATA\_LINE\_EXCLUSION. | `string` | `null` | no |
152-
| <a name="input_logdna_agent_custom_line_inclusion"></a> [logdna\_agent\_custom\_line\_inclusion](#input\_logdna\_agent\_custom\_line\_inclusion) | LogDNA agent custom configuration for line inclusion setting LOGDNA\_K8S\_METADATA\_LINE\_INCLUSION. | `string` | `null` | no |
153-
| <a name="input_logdna_agent_tags"></a> [logdna\_agent\_tags](#input\_logdna\_agent\_tags) | array of tags to group the host logs pushed by the logdna agent | `list(string)` | `[]` | no |
154-
| <a name="input_logdna_agent_version"></a> [logdna\_agent\_version](#input\_logdna\_agent\_version) | Version of the agent to deploy. To lookup version run: `ibmcloud cr images --restrict ext/logdna-agent`. If null, the default value is used. | `string` | `"3.9.1-20231214.d51836ef681843f3"` | no |
155-
| <a name="input_logdna_enabled"></a> [logdna\_enabled](#input\_logdna\_enabled) | Deploy IBM Cloud Logging agent | `bool` | `true` | no |
156-
| <a name="input_logdna_ingestion_key"></a> [logdna\_ingestion\_key](#input\_logdna\_ingestion\_key) | Ingestion key for the IBM Cloud Logging agent to communicate with the instance | `string` | `null` | no |
157-
| <a name="input_logdna_instance_name"></a> [logdna\_instance\_name](#input\_logdna\_instance\_name) | IBM Cloud Logging instance to use. Required if LogDNA is enabled | `string` | `null` | no |
158-
| <a name="input_logdna_resource_group_id"></a> [logdna\_resource\_group\_id](#input\_logdna\_resource\_group\_id) | Resource group the IBM Cloud Logging instance is in. Defaults to Clusters group | `string` | `null` | no |
159-
| <a name="input_sysdig_access_key"></a> [sysdig\_access\_key](#input\_sysdig\_access\_key) | Access key used by the IBM Cloud Monitoring agent to communicate with the instance | `string` | `null` | no |
160-
| <a name="input_sysdig_add_cluster_name"></a> [sysdig\_add\_cluster\_name](#input\_sysdig\_add\_cluster\_name) | If true, configure the sysdig agent to attach a tag containing the cluster name to all metric data. | `bool` | `true` | no |
161-
| <a name="input_sysdig_agent_tags"></a> [sysdig\_agent\_tags](#input\_sysdig\_agent\_tags) | array of tags to group the host metrics pushed by the sysdig agent | `list(string)` | `[]` | no |
162-
| <a name="input_sysdig_agent_version"></a> [sysdig\_agent\_version](#input\_sysdig\_agent\_version) | IBM Cloud Monitoring Agent Version. To lookup version run: `ibmcloud cr images --restrict ext/sysdig/agent`. If null, the default value is used. | `string` | `"12.18.0"` | no |
163-
| <a name="input_sysdig_enabled"></a> [sysdig\_enabled](#input\_sysdig\_enabled) | Deploy IBM Cloud Monitoring agent | `bool` | `true` | no |
164-
| <a name="input_sysdig_instance_name"></a> [sysdig\_instance\_name](#input\_sysdig\_instance\_name) | The name of the IBM Cloud Monitoring instance to use. Required if Sysdig is enabled | `string` | `null` | no |
165-
| <a name="input_sysdig_metrics_filter"></a> [sysdig\_metrics\_filter](#input\_sysdig\_metrics\_filter) | To filter custom metrics, specify the Sysdig metrics to include or to exclude. See https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics. | <pre>list(object({<br> type = string<br> name = string<br> }))</pre> | `[]` | no |
166-
| <a name="input_sysdig_resource_group_id"></a> [sysdig\_resource\_group\_id](#input\_sysdig\_resource\_group\_id) | Resource group that the IBM Cloud Monitoring is in. Defaults to Clusters group | `string` | `null` | no |
158+
| <a name="input_log_analysis_add_cluster_name"></a> [log\_analysis\_add\_cluster\_name](#input\_log\_analysis\_add\_cluster\_name) | If true, configure the log analysis agent to attach a tag containing the cluster name to all log messages. | `bool` | `true` | no |
159+
| <a name="input_log_analysis_agent_custom_line_exclusion"></a> [log\_analysis\_agent\_custom\_line\_exclusion](#input\_log\_analysis\_agent\_custom\_line\_exclusion) | Log Analysis agent custom configuration for line exclusion setting LOGDNA\_K8S\_METADATA\_LINE\_EXCLUSION. | `string` | `null` | no |
160+
| <a name="input_log_analysis_agent_custom_line_inclusion"></a> [log\_analysis\_agent\_custom\_line\_inclusion](#input\_log\_analysis\_agent\_custom\_line\_inclusion) | Log Analysis agent custom configuration for line inclusion setting LOGDNA\_K8S\_METADATA\_LINE\_INCLUSION. | `string` | `null` | no |
161+
| <a name="input_log_analysis_agent_tags"></a> [log\_analysis\_agent\_tags](#input\_log\_analysis\_agent\_tags) | array of tags to group the host logs pushed by the log analysis agent | `list(string)` | `[]` | no |
162+
| <a name="input_log_analysis_agent_version"></a> [log\_analysis\_agent\_version](#input\_log\_analysis\_agent\_version) | Version of the agent to deploy. To lookup version run: `ibmcloud cr images --restrict ext/logdna-agent`. If null, the default value is used. | `string` | `"3.9.1-20231214.d51836ef681843f3"` | no |
163+
| <a name="input_log_analysis_enabled"></a> [log\_analysis\_enabled](#input\_log\_analysis\_enabled) | Deploy IBM Cloud Logging agent | `bool` | `true` | no |
164+
| <a name="input_log_analysis_ingestion_key"></a> [log\_analysis\_ingestion\_key](#input\_log\_analysis\_ingestion\_key) | Ingestion key for the IBM Cloud Logging agent to communicate with the instance | `string` | `null` | no |
165+
| <a name="input_log_analysis_instance_name"></a> [log\_analysis\_instance\_name](#input\_log\_analysis\_instance\_name) | IBM Cloud Logging instance to use. Required if Log Analysis is enabled | `string` | `null` | no |
166+
| <a name="input_log_analysis_resource_group_id"></a> [log\_analysis\_resource\_group\_id](#input\_log\_analysis\_resource\_group\_id) | Resource group the IBM Cloud Logging instance is in. Defaults to Clusters group | `string` | `null` | no |
167167

168168
### Outputs
169169

cra-tf-validate-ignore-rules.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
"description:": "Check whether OpenShift clusters are accessible only by using private endpoints",
1212
"ignore_reason": "This rule is not relevant to the module itself, just the cluster resource that is used in the example that is scanned",
1313
"is_valid": false
14+
},
15+
{
16+
"scc_rule_id": "rule-64c0bea0-8760-4a6b-a56c-ee375a48961e",
17+
"description:": "Check whether Virtual Private Cloud (VPC) has no public gateways attached",
18+
"ignore_reason": "This rule is not relevant to the module itself, just the VPC resource that is used in the example that is scanned",
19+
"is_valid": false
1420
}
1521
]
1622
}

examples/basic/main.tf

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,20 @@ resource "ibm_is_vpc" "example_vpc" {
4040
tags = var.resource_tags
4141
}
4242

43+
resource "ibm_is_public_gateway" "public_gateway" {
44+
name = "${var.prefix}-gateway-1"
45+
vpc = ibm_is_vpc.example_vpc.id
46+
resource_group = module.resource_group.resource_group_id
47+
zone = "${var.region}-1"
48+
}
49+
4350
resource "ibm_is_subnet" "testacc_subnet" {
4451
name = "${var.prefix}-subnet"
4552
vpc = ibm_is_vpc.example_vpc.id
4653
zone = "${var.region}-1"
4754
total_ipv4_address_count = 256
4855
resource_group = module.resource_group.resource_group_id
56+
public_gateway = ibm_is_public_gateway.public_gateway.id
4957
}
5058

5159
resource "ibm_resource_instance" "cos_instance" {
@@ -102,22 +110,22 @@ resource "time_sleep" "wait_operators" {
102110

103111

104112
module "observability_agents" {
105-
source = "../.."
106-
depends_on = [time_sleep.wait_operators]
107-
cluster_id = ibm_container_vpc_cluster.cluster.id
108-
cluster_resource_group_id = module.resource_group.resource_group_id
109-
logdna_instance_name = module.observability_instances.log_analysis_name
110-
logdna_ingestion_key = module.observability_instances.log_analysis_ingestion_key
111-
sysdig_instance_name = module.observability_instances.cloud_monitoring_name
112-
sysdig_access_key = module.observability_instances.cloud_monitoring_access_key
113-
logdna_agent_tags = var.resource_tags
114-
logdna_add_cluster_name = true
113+
source = "../.."
114+
depends_on = [time_sleep.wait_operators]
115+
cluster_id = ibm_container_vpc_cluster.cluster.id
116+
cluster_resource_group_id = module.resource_group.resource_group_id
117+
log_analysis_instance_name = module.observability_instances.log_analysis_name
118+
log_analysis_ingestion_key = module.observability_instances.log_analysis_ingestion_key
119+
cloud_monitoring_instance_name = module.observability_instances.cloud_monitoring_name
120+
cloud_monitoring_access_key = module.observability_instances.cloud_monitoring_access_key
121+
log_analysis_agent_tags = var.resource_tags
122+
log_analysis_add_cluster_name = true
115123
# example of how to include / exclude metrics - more info https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_log_metrics
116-
sysdig_metrics_filter = [{ type = "exclude", name = "metricA.*" }, { type = "include", name = "metricB.*" }]
117-
sysdig_agent_tags = var.resource_tags
118-
# LogDNA agent custom settings to setup Kubernetes metadata logs filtering by setting
124+
cloud_monitoring_metrics_filter = [{ type = "exclude", name = "metricA.*" }, { type = "include", name = "metricB.*" }]
125+
cloud_monitoring_agent_tags = var.resource_tags
126+
# Log Analysis agent custom settings to setup Kubernetes metadata logs filtering by setting
119127
# LOGDNA_K8S_METADATA_LINE_INCLUSION and LOGDNA_K8S_METADATA_LINE_EXCLUSION in the agent daemonset definition
120128
# Ref https://github.com/logdna/logdna-agent-v2/blob/3.8/docs/KUBERNETES.md#configuration-for-kubernetes-metadata-filtering
121-
logdna_agent_custom_line_exclusion = "label.app.kubernetes.io/name:sample-app\\, annotation.user:sample-user"
122-
logdna_agent_custom_line_inclusion = "namespace:default"
129+
log_analysis_agent_custom_line_exclusion = "label.app.kubernetes.io/name:sample-app\\, annotation.user:sample-user"
130+
log_analysis_agent_custom_line_inclusion = "namespace:default"
123131
}

0 commit comments

Comments
 (0)