You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to version 0.15.0, terraform plan fails with the error "Invalid count argument" when planning on an empty configuration (no existing resources) if the variable master_password is set from a random_password resource.
╷
│ Error: Invalid count argument
│
│ on .terraform/modules/documentdb_cluster/main.tf line 43, in resource "random_password" "password":
│ 43: count = module.this.enabled && var.master_password != "" ? 0 : 1
│
│ 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.
╵
Environment (please complete the following information):
OS: Linux
Terraform version: 1.1.8
Version: 0.15.0
Additional Context
The separate random_password resource is there because this code was written against version 0.14.
The easy workaround for this would be to remove the random_password resource and use the one provided by the module, but that doesn't work for our purposes because the module doesn't return the generated password (in our case, it gets stored in Secrets Manager).
Providing the password as an output would be the easiest fix for this, but another way would be to add a separate generate_password boolean parameter.
Aside - it looks like there may be another bug in the count condition:
Found a bug? Maybe our Slack Community can help.
Describe the Bug
After upgrading to version 0.15.0,
terraform plan
fails with the error "Invalid count argument" when planning on an empty configuration (no existing resources) if the variablemaster_password
is set from arandom_password
resource.Expected Behavior
The configuration should be planned.
Steps to Reproduce
This is a minimal configuration to reproduce:
Run
terraform plan
to get the error.Screenshots
Environment (please complete the following information):
Additional Context
The separate
random_password
resource is there because this code was written against version 0.14.The easy workaround for this would be to remove the
random_password
resource and use the one provided by the module, but that doesn't work for our purposes because the module doesn't return the generated password (in our case, it gets stored in Secrets Manager).Providing the password as an output would be the easiest fix for this, but another way would be to add a separate
generate_password
boolean parameter.Aside - it looks like there may be another bug in the
count
condition:If
module.this.enabled
isfalse
, thencount
is always set to 1 - this should surely be the other way around?The text was updated successfully, but these errors were encountered: