cloudposse / terraform-aws-elasticsearch

Terraform module to provision an Elasticsearch cluster with built-in integrations with Kibana and Logstash.
https://cloudposse.com/accelerate
Apache License 2.0
218 stars 231 forks source link

Fix `count` for resources #52

Closed aknysh closed 4 years ago

aknysh commented 4 years ago

what

why

Error: Invalid count argument
 on .terraform/modules/search_service_elasticsearch_master.elasticsearch/main.tf line 76, in resource "aws_iam_service_linked_role" "default":
 76:   count            = var.enabled && var.create_iam_service_linked_role && length(data.aws_iam_role.default.*.id) == 0 ? 1 : 0
The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.