I am trying to setup terraform with modules and when doing terraform init
after creating a module I have ran into an issue where I am told it does not exist or can't be read. I've checked many times and tried many paths to it and it does exist where I think it does.
Not sure in that case why it can't be read. I've included my main.tf file as well as the modules/queues.tf file
main.tf
| main.tf
| modules
| queues.tf
main.tf
# This file brings together all of the modules
variable "environments" {
type = list(string)
}
module "pae_queues" {
source = "./modules/queues.tf"
environments = "${var.environments}"
}
queues.tf
variable "environments" {
type = "list(string)"
}
resource "aws_sqs_queue" "email_queue_${var.environments[count.index]}" {
count = length(${var.environments})
name = "email_queue_${var.environments[count.index]}"
delay_seconds = 0
max_message_size = 2048
message_retention_seconds = 86400
receive_wait_time_seconds = 10
redrive_policy = "{\"deadLetterTargetArn\":\"${aws_sqs_queue.terraform_queue_deadletter.arn}\",\"maxReceiveCount\":3}"
tags = {
Environment = "${var.environments[count.index]}"
}
}