-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Invalid count argument - db_subnet_group_name #223
Comments
I was able to do this without issue in my configuration. What version of terraform are you using? That may be the problem. |
I just had the same issue with the Terraform AWS provider v2.61.0 & TF 0.12.24 @rafmagns-skepa-dreag what versions are you on? |
Update I figured the problem out. This occurs because Terraform under the hood is evaluating the My solution: db_subnet_group_name = local.create_test_resources ? module.rds.rds_parameter_groups_output["hr_subnet_group_name"] : ""
@ahummel25 let me know if this works for you. |
@drexler That doesn't seem to work for me. Still getting same exact error. Here's what I tried.
locals {
create_test_resources = true
}
module "db" {
source = "./rds"
name = var.name
my_ip = chomp(data.http.icanhazip.body)
rds_vpc_id = module.bastion-networking.vpc_id
rds_security_group_id = module.bastion-networking.bastion_security_group_id
eip_private_ip_address = module.bastion-networking.eip_private_ip_address
database_subnet_group_name = local.create_test_resources ? module.bastion-networking.database_subnet_group_name : var.database_subnet_group_name
all_tags = var.all_tags
} |
@ahummel25 put the conditional check within the module that imports the In my setup i have: module "asurecloud_hr_db" {
source = "terraform-aws-modules/rds/aws"
version = "2.15"
create_db_instance = local.create_test_resources
db_subnet_group_name = local.create_test_resources ? module.rds.rds_parameter_groups_output["hr_subnet_group_name"] : ""
option_group_name = local.create_test_resources ? module.rds.rds_parameter_groups_output["hr_option_group_name"] : ""
create_db_parameter_group = false
...
} |
Dang, no luck. Just tried that. So changed my setup to below. And I moved my Call to module: module "db" {
source = "./rds"
name = var.name
my_ip = chomp(data.http.icanhazip.body)
rds_vpc_id = module.bastion-networking.vpc_id
rds_security_group_id = module.bastion-networking.bastion_security_group_id
eip_private_ip_address = module.bastion-networking.eip_private_ip_address
database_subnet_group_name = module.bastion-networking.database_subnet_group_name
all_tags = var.all_tags
} RDS Module: module "db" {
source = "terraform-aws-modules/rds/aws"
identifier = "some_id"
engine = "mysql"
engine_version = "8.0.11"
instance_class = "db.t2.small"
allocated_storage = 5
storage_encrypted = false
...
vpc_security_group_ids = [module.mysql_security_group.this_security_group_id]
create_db_subnet_group = false
db_subnet_group_name = local.create_test_resources ? var.database_subnet_group_name : ""
...
} |
hmmm... that's interesting. The only difference between yours and mine is that i have my |
This is a serious bug that needs to be fixed. From the local variable defined, terraform fails to infer the proper type of locals { module "db_subnet_group" { create = local.enable_create_db_subnet_group tags = var.tags |
I'm also running into this, would love to see a fix |
@vmendoza Is the code you pasted in your comment the actual source of the bug? Just curious if you did the leg work there. I never dug thru that deep. |
Hi, I have the same error: Error
RDS module:
VPC module:
Terraform version:
Work around:Run first apply the VPC
Then, apply all
|
Seeing the same thing on Terraform v0.14.0 |
Seems like maybe changing this line could fix it - https://github.com/terraform-aws-modules/terraform-aws-rds/blob/master/main.tf#L3
|
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. |
I get this error when trying to set
db_subnet_group_name
to an output value from another module. In addition to setting that, I also tried settingcreate_db_subnet_group
tofalse
so as to ensure my RDS instance gets placed in an existing VPC's subnet group.Seems to have occurred on
acm
as well: terraform-aws-modules/terraform-aws-acm#10Call to module:
Module:
The text was updated successfully, but these errors were encountered: