Skip to content

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

@JoshCoady

Description

@JoshCoady

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions