Providing master_ipv4_cidr_block and subnet range using terraform variables in GCP

I have created a private cluster in GCP using terraform modules.
As per the documentation here:, I have configured the provate cluster as below:

 private_cluster_config { 
   enable_private_endpoint = true 	
   enable_private_nodes    = true 
   master_ipv4_cidr_block  = "${cidrsubnet(var.cidr, 28, 1)}"

This cluster is provisioned in a subnet whose CIDR range is (var.cidr is set to
When I run terraform apply, I get the below error:

Error waiting for creating GKE cluster: The given master_ipv4_cidr overlaps with an existing network
"${cidrsubnet(`var.cidr`, 12, 1)}"

How do I provide the master_ipv4_cidr_block IPV4 address range and subnet range using value provided in var.cidr so that the ranges dont overlap?
How should the cidrsubent() be modified to suit this requirement?