tf_aws_elasticsearch icon indicating copy to clipboard operation
tf_aws_elasticsearch copied to clipboard

Error: Invalid count argument

Open ProxiBlue opened this issue 5 years ago • 0 comments

Hello,

Any idea what is wrong? Worked once, destroyed once, then on any further retries:

11:55 $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.template_file.installation_template: Refreshing state...
data.aws_availability_zones.all: Refreshing state...

------------------------------------------------------------------------

Error: Invalid count argument

  on .terraform/modules/es/main.tf line 30, in resource "aws_elasticsearch_domain" "es":
  30:   count = false == local.inside_vpc ? 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.


Error: Invalid count argument

  on .terraform/modules/es/main_vpc.tf line 31, in resource "aws_elasticsearch_domain" "es_vpc":
  31:   count = local.inside_vpc ? 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.

11:55 $ terraform --version Terraform v0.12.20

  • provider.aws v2.49.0
  • provider.template v2.1.2
 module "es" {
  source  = "git::https://github.com/terraform-community-modules/tf_aws_elasticsearch.git?ref=v1.2.0"

  domain_name                    = "enjo-elasticsearch-domain"
  vpc_options                    = {
    security_group_ids = [ aws_security_group.rds.id ]
    subnet_ids         = aws_elb.magento.subnets
  }
  instance_count                 = 2
  ebs_volume_size                = 100
}

ProxiBlue avatar Feb 19 '20 03:02 ProxiBlue