Skip to content

Commit 5208d98

Browse files
committed
addressed review comments
1 parent 9bf9af7 commit 5208d98

File tree

6 files changed

+69
-75
lines changed

6 files changed

+69
-75
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ No modules.
146146
| <a name="input_metrics_filter"></a> [metrics\_filter](#input\_metrics\_filter) | To filter custom metrics you can specify which metrics to include and exclude. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics | <pre>list(object({<br/> include = optional(string)<br/> exclude = optional(string)<br/> }))</pre> | `[]` | no |
147147
| <a name="input_name"></a> [name](#input\_name) | The name to give the agent helm release. | `string` | `"sysdig-agent"` | no |
148148
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace to deploy the agent to. | `string` | `"ibm-observe"` | no |
149-
| <a name="input_prometheus_config"></a> [prometheus\_config](#input\_prometheus\_config) | Prometheus configuration for the agent. If you want to enable Prometheus configuration provide the prometheus.yaml file content in `hcl` format. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-types.md#prometheus). | `map(any)` | `{}` | no |
149+
| <a name="input_prometheus_config"></a> [prometheus\_config](#input\_prometheus\_config) | Prometheus configuration for the agent. If you want to enable Prometheus configuration provide the prometheus.yaml file content in `hcl` format. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-types.md#prometheus_config). | `map(any)` | `{}` | no |
150150
| <a name="input_tolerations"></a> [tolerations](#input\_tolerations) | List of tolerations to apply to the agent. | <pre>list(object({<br/> key = optional(string)<br/> operator = optional(string)<br/> value = optional(string)<br/> effect = optional(string)<br/> tolerationSeconds = optional(number)<br/> }))</pre> | <pre>[<br/> {<br/> "operator": "Exists"<br/> },<br/> {<br/> "effect": "NoSchedule",<br/> "key": "node-role.kubernetes.io/master",<br/> "operator": "Exists"<br/> }<br/>]</pre> | no |
151151
| <a name="input_use_private_endpoint"></a> [use\_private\_endpoint](#input\_use\_private\_endpoint) | Whether send data over a private endpoint or not. To use a private endpoint, you must enable virtual routing and forwarding (VRF) for your account. See https://cloud.ibm.com/docs/account?topic=account-vrf-service-endpoint. | `bool` | `true` | no |
152152
| <a name="input_use_scc_wp_endpoint"></a> [use\_scc\_wp\_endpoint](#input\_use\_scc\_wp\_endpoint) | By default an IBM Cloud Monitoring endpoint is used and is constructed from the `instance_region` and `use_private_endpoint` inputs. To use an IBM Cloud Security and Compliance Center Workload Protection endpoint instead, set this to true. | `bool` | `false` | no |

examples/obs-agent-iks/main.tf

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,38 @@ module "monitoring_agents" {
145145
is_vpc_cluster = var.is_vpc_cluster
146146
access_key = module.cloud_monitoring.access_key
147147
instance_region = var.region
148-
prometheus_config = var.prometheus_config
148+
prometheus_config = {
149+
config = {
150+
scrape_configs = [
151+
{
152+
job_name = "testing-prometheus-scrape"
153+
tls_config = {
154+
insecure_skip_verify = true
155+
}
156+
kubernetes_sd_configs = [
157+
{
158+
role = "pod"
159+
}
160+
]
161+
relabel_configs = [
162+
{
163+
action = "keep"
164+
source_labels = ["__meta_kubernetes_pod_host_ip"]
165+
regex = "__HOSTIPS__"
166+
},
167+
{
168+
action = "drop"
169+
source_labels = ["__meta_kubernetes_pod_annotation_promcat_sysdig_com_omit"]
170+
regex = "true"
171+
},
172+
{
173+
source_labels = ["__meta_kubernetes_pod_phase"]
174+
action = "keep"
175+
regex = "Running"
176+
}
177+
]
178+
}
179+
]
180+
}
181+
}
149182
}

examples/obs-agent-iks/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,3 @@ variable "datacenter" {
3939
description = "If creating a classic cluster, the data center where the cluster is created"
4040
default = "syd01"
4141
}
42-
43-
variable "prometheus_config" {
44-
description = "Prometheus configuration for the agent. If you want to enable Prometheus configuration provide the prometheus.yaml file content in `hcl` format. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-types.md#prometheus)."
45-
type = map(any)
46-
default = {}
47-
}

solutions/fully-configurable/DA-types.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,38 @@ object({
6464
### Example Usage
6565

6666
```hcl
67-
config = {
68-
scrape_configs = [
69-
{
70-
job_name = "testing-prometheus-scrape"
71-
tls_config = {
72-
insecure_skip_verify = true
73-
}
74-
kubernetes_sd_configs = [
75-
{
76-
role = "pod"
77-
}
78-
]
79-
relabel_configs = [
80-
{
81-
action = "keep"
82-
source_labels = ["__meta_kubernetes_pod_host_ip"]
83-
regex = "__HOSTIPS__"
84-
},
85-
{
86-
action = "drop"
87-
source_labels = ["__meta_kubernetes_pod_annotation_promcat_sysdig_com_omit"]
88-
regex = "true"
89-
},
90-
{
91-
source_labels = ["__meta_kubernetes_pod_phase"]
92-
action = "keep"
93-
regex = "Running"
67+
{
68+
config = {
69+
scrape_configs = [
70+
{
71+
job_name = "testing-prometheus-scrape"
72+
tls_config = {
73+
insecure_skip_verify = true
9474
}
95-
]
96-
}
97-
]
75+
kubernetes_sd_configs = [
76+
{
77+
role = "pod"
78+
}
79+
]
80+
relabel_configs = [
81+
{
82+
action = "keep"
83+
source_labels = ["__meta_kubernetes_pod_host_ip"]
84+
regex = "__HOSTIPS__"
85+
},
86+
{
87+
action = "drop"
88+
source_labels = ["__meta_kubernetes_pod_annotation_promcat_sysdig_com_omit"]
89+
regex = "true"
90+
},
91+
{
92+
source_labels = ["__meta_kubernetes_pod_phase"]
93+
action = "keep"
94+
regex = "Running"
95+
}
96+
]
97+
}
98+
]
99+
}
98100
}
99101
```

tests/pr_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -238,42 +238,6 @@ func TestRunAgentVpcKubernetes(t *testing.T) {
238238
},
239239
CloudInfoService: sharedInfoSvc,
240240
})
241-
242-
prometheus_config := map[string]interface{}{
243-
244-
"scrape_configs": []map[string]interface{}{
245-
{
246-
"job_name": "testing-prometheus-scrape",
247-
"tls_config": map[string]interface{}{
248-
"insecure_skip_verify": true,
249-
},
250-
"kubernetes_sd_configs": []map[string]interface{}{
251-
{
252-
"role": "pod",
253-
},
254-
},
255-
"relabel_configs": []map[string]interface{}{
256-
{
257-
"action": "keep",
258-
"source_labels": []string{"__meta_kubernetes_pod_host_ip"},
259-
"regex": "__HOSTIPS__",
260-
},
261-
{
262-
"action": "drop",
263-
"source_labels": []string{"__meta_kubernetes_pod_annotation_promcat_sysdig_com_omit"},
264-
"regex": true,
265-
},
266-
{
267-
"action": "keep",
268-
"source_labels": []string{"__meta_kubernetes_pod_phase"},
269-
"regex": "Running",
270-
},
271-
},
272-
},
273-
},
274-
}
275-
276-
options.TerraformVars["prometheus_config"] = prometheus_config
277241
output, err := options.RunTestConsistency()
278242
assert.Nil(t, err, "This should not have errored")
279243
assert.NotNil(t, output, "Expected some output")

variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,10 @@ variable "container_filter" {
291291
}
292292

293293
variable "prometheus_config" {
294-
description = "Prometheus configuration for the agent. If you want to enable Prometheus configuration provide the prometheus.yaml file content in `hcl` format. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-types.md#prometheus)."
294+
description = "Prometheus configuration for the agent. If you want to enable Prometheus configuration provide the prometheus.yaml file content in `hcl` format. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/blob/main/solutions/fully-configurable/DA-types.md#prometheus_config)."
295295
type = map(any)
296296
default = {}
297+
nullable = false
297298
}
298299

299300
##############################################################################

0 commit comments

Comments
 (0)