-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Describe the bug
The resource elasticstack_fleet_package_policy
does not allow the deployment of package policies with zero inputs; specifically a package policy for the Elastic Agent package. The Elastic Agent package requires no configuration, thus no inputs. This could be considered a feature request since the behavior is expected, but I have issued it as a bug since the resource doe not handle all possible scenarios.
{ "id": "78d6f340-2fd0-11ee-8e61-b7fe88cXXXXX", "version": "WzE5MDE3LDdd", "name": "elastic_agent-1", "namespace": "default", "description": "", "package": { "name": "elastic_agent", "title": "Elastic Agent", "version": "1.10.0" }, "enabled": true, "policy_id": "b2c90fc0-2fa3-11ee-8e61-b7fe88c46c49", "inputs": [], "revision": 2, "created_at": "2023-07-31T18:31:32.840Z", "created_by": "XXXX", "updated_at": "2023-07-31T19:14:10.250Z", "updated_by": "XXXX" },
To Reproduce
Steps to reproduce the behavior:
- TF configuration used '...'
resource "elasticstack_fleet_package_policy" "sample" {
agent_policy_id = var.agent_policy_id
dynamic input {
for_each = local.inputs
content {
enabled = input.value.enabled
input_id = input.value.input_id
streams_json = input.value.streams_json
vars_json = input.value.vars_json
}
}
name = var.name
namespace = var.namespace
package_name = var.package_name
package_version = var.package_version
description = var.description
enabled = var.enabled
force = var.force
policy_id = var.policy_id
vars_json = local.vars_json
}
Where local.inputs
is an empty list
- TF operations to execute to get the error '...' [e.g
terraform plan
,terraform apply
,terraform destroy
]
terraform plan - See the error in the output '...'
╷
│ Error: Insufficient input blocks
│
│ on modules/fleet_package_policy/main.tf line 1, in resource "elasticstack_fleet_package_policy" "sample":
│ 1: resource "elasticstack_fleet_package_policy" "sample" {
│
│ At least 1 "input" blocks are required.
╵
ERRO[0021] 1 error occurred:
* exit status 1
This has also been attempted with an empty input block which results in the following:
╷
│ Error: Missing required argument
│
│ on modules/fleet_package_policy/main.tf line 14, in resource "elasticstack_fleet_package_policy" "sample":
│ 14: content {}
│
│ The argument "input_id" is required, but no definition was found.
╵
ERRO[0024] 1 error occurred:
* exit status 1
Expected behavior
A clear and concise description of what you expected to happen.
The resource be deployed without any inputs
defined
Debug output
Run terraform
command with TF_LOG=trace
and provide extended information on TF operations.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
- OS: [e.g. Linux]
- Terraform Version [e.g. 1.0.0]
- Provider version [e.g. v0.1.0]
- Elasticsearch Version [e.g. 7.16.0]
Additional context
Add any other context about the problem here.