Open davidmaceachern opened 1 year ago
This sounds like the google-workspace
bundle is either defined in the TF resource twice, or somehow getting duplicated when the provider is reading state from the API. I'd need to see the actual module code to help more on this one.
│ Error: Duplicate Set Element
│
│ with module.elastic[0].ec_deployment.default,
│ on .terraform/modules/elastic/main.tf line 20, in resource "ec_deployment" "default":
│ 20: resource "ec_deployment" "default" {
│
│ This attribute contains duplicate values of:
│ tftypes.Object["name":tftypes.String, "type":tftypes.String,
│ "url":tftypes.String,
│ "version":tftypes.String]<"name":tftypes.String<"google-workspace">,
│ "type":tftypes.String<"bundle">, "url":tftypes.String<"repo://1142903475">,
│ "version":tftypes.String<"8.9.0">>
module "elastic" {
deployment_template_id = "aws-hot-warm-v3"
hot_tier_topology = {
zone_count = 1
size = "1g"
size_resource = "memory"
autoscaling = {}
}
}
You probably don't want to use the hot-warm template here. I think you've figured this out, but all data tiers are available on all the current templates. Something like aws-storage-optimized-dense-v4
will be better suited. There's probably some updates we can make to the Terraform docs around selecting a template.
IIRC the hot-warm has a default non-zero size for the warm tier which is causing the Provider produced inconsistent result
error. If you want to use the hot-warm template (you almost certainly don't), then you'd need to define a warm tier. We might be able to do improve how the provider handles this, but that would likely just be a nicer error message (e.g "Using the x template requires defining y data tier") since resolving the inconsistent result may be somewhat complex.
Thanks for the fast response @tobio !
This sounds like the google-workspace bundle is either defined in the TF resource twice <...>
Great spot sorry for the brief example I provided, we figured this out yesterday that it was indeed defined twice! Have a workaround to remove it and fix will be to move it outside of the module.
There's probably some updates we can make to the Terraform docs around selecting a template.
Is there a schema somewhere that declares what is going to be a non-zero configuration?
I've had a dig into the source code and searched the docs however the only guidance I have right now is the list in the official Elastic docs https://www.elastic.co/guide/en/cloud/current/ec-regions-templates-instances.html
I understand it is also possible from running a terraform plan for a new cluster however I don't have a fast way of doing right now.
Update on the data tier blocker, we managed to manually remove the warm tier from ES dashboard, and remove the Google workspace plugin, then rerunning terraform plan
and terraform apply
allow us to successfully switch the deployment template.
Our current docs link through to the complete list of deployment templates available in ESS. This is pretty overwhelming, and also potentially misleading to new customers. For example, the old dedicated hot-warm, cross cluster search, and enterprise search templates are listed there, which have been made completely redundant by the current templates. We should either improve the existing docs to mark old templates as deprecated, or develop simplified, provider specific docs helping customers choose a template.
Original issue
Readiness Checklist
Expected Behavior
When running terraform apply to remove a data tier, if there is a problem with removing the data tier, the resulting error should indicate why the problem occurred.
Current Behavior
Expanded on in definition section below, terraform plan and apply is being run in the following docker image in a gitlab ci/cd https://hub.docker.com/layers/hashicorp/terraform/1.2.7/images/sha256-8e4d010fc675dbae1eb6eee07b8fb4895b04d144152d2ef5ad39724857857ccb?context=explore
Terraform definition
Trying to implement this by wrapping the provider in a tf module, have omitted all those details for brevity.
First encountered the error on provider 0.7.0 and tf 1.2.0, here are the provider details we are using in most recent attempt in module's
provider.tf
:First a cluster was created with the following configuration in
elastic.tf
, a warm tier was never added to the cluster explicitly.The resource configuration we wish to apply, in
elastic.tf
:Steps to Reproduce
terraform apply
a cluster with hot tier and deployment templateaws-hot-warm-v3
terraform apply
the addition of some other tiers, without a warm tierterraform apply
a deployment template which could be better suited to the cluster, e.g.aws-storage-optimized-dense-v4
Context
Goal is to have a cluster completely defined using terraform. Expect that if it is not easy to iterate on cluster changes, then the documentation should indicate that it is best to configure a cluster manually through the dashboard before declaring in terraform.
For future cluster changes, it would also help to understand from the documentation what changes require manually testing via the dashboard, and what changes can be done via terraform.
It's expected that terraform state should not be corrupted and require manual intervention to fix, the provider should be able to successfully apply the changes or explain in documentation how to fix the issue.
Possible Solution
What has been tried so far:
What has not been tried:
Your Environment