-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Agent logging does not update from elastic_fleet_agent_policy
if both monitor_logs: false
and monitor_metrics: false
are set.
To Reproduce
Steps to reproduce the behavior:
- Define the following agent policy:
resource "elasticstack_fleet_agent_policy" "my_fleet_agent_policy" {
name = "my_fleet_agent_policy"
namespace = "default"
sys_monitoring = true
monitor_logs = true
monitor_metrics = false
}
- Apply the configuration.
- Review new fleet policy to validate that
Collect agent logs
is checked under settings. - Set
monitor_logs = false
in the agent policy. - Apply the updated configuration.
- Review updated fleet policy to validate that
Collect agent logs
is still checked under settings;terraform.tfstate
also showsmonitor_logs: true
.
Expected behavior
Collect agent logs
should not be set.
Note: If
monitor_logs: false
andmonitor_metrics: true
are both set, then the results are as expected.
Debug output
PUT /api/fleet/agent_policies/<policy-id> HTTP/1.1
Host: <redacted>
User-Agent: Go-http-client/1.1
Content-Length: 158
Authorization: ***************************************************
Content-Type: application/json
Kbn-Xsrf: true
Accept-Encoding: gzip
{
"data_output_id": null,
"download_source_id": null,
"fleet_server_host_id": null,
"monitoring_output_id": null,
"name": "my_fleet_agent_policy",
"namespace": "default"
}
Versions (please complete the following information)
- OS: macos
- Terraform Version:
1.5.7
- Provider version:
0.7.0, 0.8.0
- Elastic Cloud Version:
8.10.2
Additional context
This can be reproduced with the API from Dev Tools in Kibana. To do so, follow steps 1-3 under "steps to reproduce," then apply the following update to the policy from Dev Tools to get the same results:
PUT kbn:/api/fleet/agent_policies/<policy-id>
{
"data_output_id": null,
"description": "Test Agent Policy",
"download_source_id": null,
"fleet_server_host_id": null,
"monitoring_output_id": null,
"name": "test-policy-1",
"namespace": "default"
}
To get the expected results, it is necessary to provide an empty array for monitoring_enabled
, such as:
PUT kbn:/api/fleet/agent_policies/<policy-id>
{
"data_output_id": null,
"description": "Test Agent Policy",
"download_source_id": null,
"fleet_server_host_id": null,
"monitoring_output_id": null,
"monitoring_enabled": [],
"name": "test-policy-1",
"namespace": "default"
}
Explicitly setting monitoring_enabled: null
generates the following error:
{
"statusCode": 400,
"error": "Bad Request",
"message": "[request body.monitoring_enabled]: expected value of type [array] but got [null]"
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working