Terraform condition expression when dependency is defined

Hi,

I am trying to achieve a scenario where I have 2 postgresql database server A and B.
If my location is primary say West europe then both DB should be created however if my location is primary say South europe then I need only DB A to be created.

I tried using count in the module however it gave empty tuple error .
Any help would be much appreciated .

Hi @deeptisinha63.ds

If I understand you correctly, and using AWS as an example, then you’d need something like

data "aws_region" "current" {}

and in your db resource, something like

count = data.aws_region.current.name == "eu-west-1" ? 2 : 1