Skip to content

Invalid count argument #10

@alemairebe

Description

@alemairebe

Hi all,

I'm using Terraform v0.12.1 and I get this error when trying to plan my manifest. I do no see where "count" uses resources which needs to be deployed first.

Error: Invalid count argument

  on .terraform/modules/bootstrap.acm/terraform-aws-modules-terraform-aws-acm-566067c/main.tf line 30, in resource "aws_route53_record" "validation":
  30:   count = var.create_certificate && var.validation_method == "DNS" && var.validate_certificate ? length(local.distinct_domain_names) : 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.

Here is how I invoke the module

module "acm" {
  source  = "terraform-aws-modules/acm/aws"
  version = "v2.0.0"

  create_certificate = var.certificate_arn == "" ? true : false

  domain_name = var.acm_certificate_domain_name == "" ? join(".", list(var.name, var.route53_zone_name)) : var.acm_certificate_domain_name

  zone_id = var.certificate_arn == "" ? element(concat(data.aws_route53_zone.this.*.id, list("")), 0) : ""

  tags = "${local.tags}"
}

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions