cloudposse / terraform-aws-security-group

Terraform module to provision an AWS Security Group
https://cloudposse.com/accelerate
Apache License 2.0
36 stars 35 forks source link

enabled = false fails with "The given key does not identify an element in this collection value." #40

Closed karaluh closed 1 year ago

karaluh commented 2 years ago

Describe the Bug

terraform apply fails with the code below

module "test" {
  source  = "git::https://github.com/cloudposse/terraform-aws-security-group?ref=2.0.0-rc1"
  enabled = false
  vpc_id  = "test"
}

with the error below

╷
│ Error: Invalid index
│
│   on .terraform\modules\test\main.tf line 36, in locals:
│   36:   cbd_security_group_id = local.create_security_group ? one(aws_security_group.cbd[*].id) : var.target_security_group_id[0]
│     ├────────────────
│     │ var.target_security_group_id is empty list of string
│
│ The given key does not identify an element in this collection value.
Nuru commented 1 year ago

This has been fixed in our internal v2 release candidate.