elastic / terraform-provider-elasticstack

Terraform provider for Elastic Stack
https://registry.terraform.io/providers/elastic/elasticstack/latest/docs
Apache License 2.0
173 stars 93 forks source link

[Bug] `elasticstack_elasticsearch_snapshot_repository` gcs.base_path is ignored #925

Open BapRx opened 3 days ago

BapRx commented 3 days ago

Describe the bug

I want to configure the Base path of a GCS snapshot repository but the Terraform provider ignores the base_path setting. If I manually add it on the console, the plan doesn't even show the diff.

Image

To Reproduce Steps to reproduce the behavior:

  1. TF configuration used

    resource "elasticstack_elasticsearch_snapshot_repository" "gcs" {
    name = "elasticsearch-backup"
    
    gcs {
    bucket    = "elasticsearch-backup"
    base_path = "elasticsearch-data"
    }
    }
  2. TF operations to execute to get the error : terraform plan

Expected behavior The base path setting should be updated.

Versions (please complete the following information):

BapRx commented 3 days ago

I just realized the behavior is not exactly as described, here's what is happening :

Base path configured on Kibana base_path set in Terraform Kibana Base Path == Terraform base_path? Terraform plan shows diff? Expected behavior?
Yes No No (Terraform should set it to null or empty string) No No
Yes Yes Yes No Yes
Yes Yes No Yes Yes
No No Yes No Yes
No Yes No Yes Yes

If it's the normal behavior (base_path not set -> don't edit it on Kibana even if it is set), feel free to close the issues.

tobio commented 2 days ago

Thanks for the bug report, the table is especially helpful, 💯!

If it's the normal behavior (base_path not set -> don't edit it on Kibana even if it is set), feel free to close the issues.

This is correct. The provider won't show a diff for unconfigured attributes in this case (any most optional attributes across the provider). Another test case worth checking prior to closing this is the behaviour when base_path = null in Terraform. This should reset the base path to the ES default but I wouldn't be surprised if that's not the current behaviour though. I'll leave this open until we get a chance to test that case out.

BapRx commented 16 hours ago

Thanks for clarifying 🙂 I just tested with null and it ignores the change as well, the plan shows No changes although there is a base path configured.