elastic / terraform-provider-ec

https://registry.terraform.io/providers/elastic/ec/latest/docs
Apache License 2.0
176 stars 89 forks source link

.enterprise_search: was cty.ObjectVal([...]), but now null. #832

Open ckauf opened 3 months ago

ckauf commented 3 months ago

Readiness Checklist

Expected Behavior

The provider should be able to handle removing instance configurations by setting size: 0g

Current Behavior

The provider exists with an error message:

│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to ec_deployment.example_minimal, provider "provider[\"registry.terraform.io/elastic/ec\"]" produced an unexpected new value: .enterprise_search: was
│ cty.ObjectVal(map[string]cty.Value{"config":cty.NullVal(cty.Object(map[string]cty.Type{"docker_image":cty.String, "user_settings_json":cty.String, "user_settings_override_json":cty.String,
│ "user_settings_override_yaml":cty.String, "user_settings_yaml":cty.String})), "elasticsearch_cluster_ref_id":cty.StringVal("main-elasticsearch"),
│ "http_endpoint":cty.StringVal("http://1784f4c8fd344a26a2e2aeaefad4cae3.ent-search.westeurope.azure.elastic-cloud.com:9200"),
│ "https_endpoint":cty.StringVal("https://1784f4c8fd344a26a2e2aeaefad4cae3.ent-search.westeurope.azure.elastic-cloud.com:443"), "instance_configuration_id":cty.StringVal("azure.enterprisesearch.fsv2"),
│ "instance_configuration_version":cty.NumberIntVal(1), "latest_instance_configuration_id":cty.StringVal("azure.enterprisesearch.fsv2"), "latest_instance_configuration_version":cty.NumberIntVal(1),
│ "node_type_appserver":cty.True, "node_type_connector":cty.True, "node_type_worker":cty.True, "ref_id":cty.StringVal("main-enterprise_search"), "region":cty.StringVal("azure-westeurope"),
│ "resource_id":cty.StringVal("1784f4c8fd344a26a2e2aeaefad4cae3"), "size":cty.StringVal("0g"), "size_resource":cty.StringVal("memory"), "zone_count":cty.NumberIntVal(1)}), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

 Terraform definition

terraform {
  required_providers {
    ec = {
      source = "elastic/ec"
      version = "0.10.0"
    }
  }
}

provider "ec" {
  apikey = "<API_KEY_HERE>"
}

resource "ec_deployment" "example_minimal" {
  # Optional name.
  name = "var_test"

  region                 = "azure-westeurope"
  version                = "8.14.3"
  deployment_template_id = "azure-general-purpose"

  elasticsearch = {
    hot = {
      autoscaling = {}
    }

    frozen = {
      size = "4g"
      zone_count = var.zone_count
      autoscaling = {}
    }
  }

  kibana = {}

  enterprise_search = {
    size = "${var.size}"
    zone_count = "${var.zone_count}"
  }

  integrations_server = {}
}

variable "zone_count" {
  type = number
  default = 1
}

variable "size" {
  type = string
  default = "2g"
}

Steps to Reproduce

  1. Create deployment with definition above
  2. Set size variable to 0g
  3. Apply changes

Context

This will prevent using the ec-terraform provider in a module. The module should be able to configure deployment with different instance types and sizes via variable.

Possible Solution

none

Your Environment