Here you just need to add one more mount target in a subnet in AZ, like:
resource "aws_efs_mount_target" "efs-mount-b" {
file_system_id = "${aws_efs_file_system.magento-efs.id}"
subnet_id = "${aws_subnet.public_subnet.1.id}"
security_groups = ["${aws_security_group.efs-sg.id}"]
}
Or you can try this:
resource "aws_efs_mount_target" "efs-mount" {
count = "length(aws_subnet.public_subnet.*.id)"
file_system_id = "${aws_efs_file_system.magento-efs.id}"
subnet_id = "${element(aws_subnet.public_subnet.*.id, count.index)}"
security_groups = ["${aws_security_group.efs-sg.id}"]
}
Interested in learning AWS? Come & join: AWS Course
For more information about Terraform, check out: