Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can't 'count' new resources to be created #18049

Closed
ArturChe opened this issue May 15, 2018 · 2 comments
Closed

Can't 'count' new resources to be created #18049

ArturChe opened this issue May 15, 2018 · 2 comments

Comments

@ArturChe
Copy link

Terraform Version

Terraform v0.11.7

Terraform Configuration Files

resource "aws_cloudfront_distribution" "distribution" {
  count = "${length(var.cloudfront_distribution_count)}"
  ...
}

resource "aws_route53_record" "dns-record" {
  count   = "${length(aws_cloudfront_distribution.distribution.*.id)}"
  ...
}

Expected Behavior

Creates aws_route53_record as much as aws_cloudfront_distribution as created on previous step

Actual Behavior

Error: Error refreshing state: 1 error(s) occurred:

  • module.cloudfront.aws_route53_record.dns-record: aws_route53_record.dns-record: value of 'count' cannot be computed

Steps to Reproduce

  1. terraform init
  2. terraform plan

Additional Context

Actually error ocurres at firs time only. If I'll create aws_route53_record with script below

resource "aws_route53_record" "dns-record" {
  count   = "${length(var.cloudfront_distribution_count)}"
  ...
}

and then I'll change the script back and it will works fine!

@jbardin
Copy link
Member

jbardin commented May 15, 2018

Hi @ArturChe,

Sorry about the confusion, but the error is correct, you cannot use a yet to be computed value for count. We have an open issue here to improve the documentation around this: #17421

@jbardin jbardin closed this as completed May 15, 2018
@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants