Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Error: Invalid count argument when password comes from an aws_ssm_parameter resource #68

Open
JoshCoady opened this issue Aug 11, 2023 · 2 comments
Labels
bug 🐛 An issue with the system

Comments

@JoshCoady
Copy link

Describe the Bug

│ Error: Invalid count argument
│ 
│   on .terraform/modules/cms.db/main.tf line 54, in resource "random_password" "password":
│   54:   count   = module.this.enabled && var.master_password == "" ? 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.

Expected Behavior

Terraform plan can be applied without resource targeting.

Steps to Reproduce

set password to the value of an ssm param, for example:

master_password  = aws_ssm_parameter.db_password.value

Screenshots

No response

Environment

Terraform 1.5

Additional Context

No response

@JoshCoady JoshCoady added the bug 🐛 An issue with the system label Aug 11, 2023
@JoshCoady
Copy link
Author

In further testing, the same thing happens with a random_password resource:

master_password     = random_password.db_password.result

...

resource "random_password" "db_password" {
  length  = 100
  special = false
}

@demi4-com
Copy link

same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

2 participants