I want to create 3 ec2 instances in 3 different regions. I am using iteration and count index feature of terraform. But I am not able to apply the same feature for region parameter in aws provider.
provider "aws" {
region = "${element(var.region, count.index)}"
}
Where I am passing the values like below.
region = [ "us-east-1" , "eu-central-1" ]
instance_type = [ "t2.small" , "t2.micro" ]
I am getting following error after terraform init.
count variables are only valid within resources