terraform-aws-modules/terraform-aws-vpc

Database subnet on dual stack

Closed this issue · 1 comments

Description

I'm trying to create a simple VPC dual stack without a specific database subnet and fails due a mandatory database_subnets

  • [ x] ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: "5.17.0"

  • Terraform version: v1.4.6

  • Provider version(s): provider registry.terraform.io/hashicorp/aws v5.82.2

Reproduction Code [Required]

sample from
https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipv6-dualstack/main.tf

Steps to reproduce the behavior:

Remove line 34

database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]

and add
create_database_subnet_group = false

Expected behavior

The sample should work, database_subnets is not mandatory, the default value is "[]"

Actual behavior

│ Error: "" is not a valid CIDR block: invalid CIDR address:

│ with module.vpc.aws_subnet.database[1],
│ on .terraform\modules\vpc\main.tf line 360, in resource "aws_subnet" "database":
│ 360: cidr_block = var.database_subnet_ipv6_native ? null : element(concat(var.database_subnets, [""]), count.index)

Terminal Output Screenshot(s)

Additional context

opps I forgot to remove...
database_subnet_ipv6_prefixes = [6, 7, 8]