Skip to content

[Bug] Import of elasticstack_fleet_output resource fails to import data #506

@glisignoli

Description

@glisignoli

Describe the bug
When running terraform import elasticstack_fleet_output.test_output be7628c0-9967-11ee-9129-e3b2c5beabce, the resource imports successfully, but fails to import any fleet data (except the id).

To Reproduce
Steps to reproduce the behavior:

  1. TF configuration used:
resource "elasticstack_fleet_output" "test_output" {
  name                 = "test_output"
  type                 = "elasticsearch"
  hosts                = ["https://test.example.com:443"]
  default_integrations = false
  default_monitoring   = false
}
  1. TF operations to execute to get the error: terraform import elasticstack_fleet_output.test_output be7628c0-9967-11ee-9129-e3b2c5beabce
  2. See the error in the output:
...
...
elasticstack_fleet_output.test_output: Import prepared!
  Prepared elasticstack_fleet_output for import
...
...

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

But:

terraform state show elasticstack_fleet_output.test_output
# elasticstack_fleet_output.test_output:
resource "elasticstack_fleet_output" "test_output" {
    id = "be7628c0-9967-11ee-9129-e3b2c5beabce"
}

Expected behavior
The import of the elasticstack_fleet_output resource should contain all data from the fleet output

Debug output
Run terraform command with TF_LOG=trace and provide extended information on TF operations.

elasticstack_fleet_output.test_output: Importing from ID "be7628c0-9967-11ee-9129-e3b2c5beabce"...

elasticstack_fleet_output.test_output: Import prepared!
  Prepared elasticstack_fleet_output for import

2023-12-13T16:36:46.716+1300 [DEBUG] provider.terraform-provider-elasticstack_v0.11.0: Fleet API Request Details:
---[ REQUEST ]---------------------------------------
GET /api/fleet/outputs/be7628c0-9967-11ee-9129-e3b2c5beabce HTTP/1.1
Host: kibana.example.com
User-Agent: Go-http-client/1.1
Authorization: ***********************************************
Accept-Encoding: gzip


-----------------------------------------------------: tf_mux_provider=tf5to6server.v5tov6Server tf_req_id=fbf086db-279f-0419-61b5-956988b46919 tf_rpc=ReadResource @caller=github.com/elastic/terraform-provider-elasticstack/internal/utils/http_log.go:39 @module=elasticstack tf_provider_addr=registry.terraform.io/elastic/elasticstack tf_resource_type=elasticstack_fleet_output timestamp="2023-12-13T16:36:46.715+1300"

2023-12-13T16:36:47.067+1300 [DEBUG] provider.terraform-provider-elasticstack_v0.11.0: Fleet API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Content-Length: 233
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Security-Policy: script-src 'self'; worker-src blob: 'self'; style-src 'unsafe-inline' 'self'
Content-Type: application/json; charset=utf-8
Cross-Origin-Opener-Policy: same-origin
Date: Wed, 13 Dec 2023 03:36:46 GMT
Elastic-Api-Version: 2023-10-31
Kbn-License-Sig: 112233445566778889900
Kbn-Name: kibana.example.com
Permissions-Policy: camera=(), display-capture=(), fullscreen=(self), geolocation=(), microphone=(), web-share=()
Referrer-Policy: no-referrer-when-downgrade
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff

{
 "item": {
  "id": "be7628c0-9967-11ee-9129-e3b2c5beabce",
  "name": "test_output",
  "type": "elasticsearch",
  "hosts": [
   "https://test.example.com:443"
  ],
  "is_default": false,
  "is_default_monitoring": false,
  "config_yaml": "",
  "ca_trusted_fingerprint": ""
 }
}
-----------------------------------------------------: tf_mux_provider=tf5to6server.v5tov6Server tf_req_id=fbf086db-279f-0419-61b5-956988b46919 tf_resource_type=elasticstack_fleet_output tf_rpc=ReadResource @caller=github.com/elastic/terraform-provider-elasticstack/internal/utils/http_log.go:51 @module=elasticstack tf_provider_addr=registry.terraform.io/elastic/elasticstack timestamp="2023-12-13T16:36:47.066+1300"
2023-12-13T16:36:47.070+1300 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-12-13T16:36:47.074+1300 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/elastic/elasticstack/0.11.0/linux_amd64/terraform-provider-elasticstack_v0.11.0 pid=10944
2023-12-13T16:36:47.075+1300 [DEBUG] provider: plugin exited
2023-12-13T16:36:47.075+1300 [INFO]  Writing state output to:
2023-12-13T16:36:47.076+1300 [DEBUG] states/remote: state read serial is: 731; serial is: 731
2023-12-13T16:36:47.076+1300 [DEBUG] states/remote: state read lineage is: 8abb57a4-3141-f59f-5d04-cb3b79b681a1; lineage is: 8abb57a4-3141-f59f-5d04-cb3b79b681a1

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.


Versions (please complete the following information):

  • OS: RedHat
  • Terraform Version 1.6.5
  • Provider version 0.11.0
  • Elasticsearch Version 8.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions