Skip to content

Cannot Upgrade Fleet Integration when agents are using the integration #564

@markjandejong

Description

@markjandejong

Describe the bug
When attempting to upgrade the Fleet integration to a newer version when in use by Agents, an error occurs.

  # module.fleet_integration["juniper_srx"].elasticstack_fleet_integration.main must be replaced
+/- resource "elasticstack_fleet_integration" "main" {
      ~ id      = "75ecee05ad0cad8ab715f26ab2876aa0f9673f47" -> (known after apply)
        name    = "juniper_srx"
      ~ version = "1.20.0" -> "1.20.1" # forces replacement

╷
│ Error: Unexpected status code from server: got HTTP 400
│ 
│ {"statusCode":400,"error":"Bad Request","message":"unable to remove package
│ with existing package policy(s) in use by agent(s)"}
╵
ERRO[0055] 1 error occurred:
        * exit status 1

Every attempt to mitigate the error have been unsuccessful. Setting either force and/or skip_destroy to true does not resolve the issue. I have attempted to add lifecycle { create_before_destroy: true } on the resource. This does deploy the latest version, but then cannot remove the older version, presenting the same error as above.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy Fleet integrations using terraform.
  2. Deploy Fleet policies using the Fleet integration.
  3. Assign the policy to agents.
  4. Attempt to increase the version number of the Fleet integration to upgrade.

Expected behavior
The integration should upgrade as it would by clicking the upgrade button in the Kibana Fleet UI.

Versions (please complete the following information):

  • OS: linux
  • Terraform Version 4.6
  • Provider version 0.11.0
  • Elasticsearch Version 8.11.4

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions