RDS connection issue

I have created one RDS mysql DB and one instance up and running. I have also enabled the security group for mysql but still i am not able to write anything from the wordpress application to my newly created DB. I need help in this. My TF code follows

[root@ip-172-31-86-171 db2]# terraform -version
Terraform v0.11.13

  • provider.aws v2.54.0
    =================================

[root@ip-172-31-86-171 db2]# cat db2.tf
data “aws_security_group” “allow” {
filter {
name = “group-name”
values = [" allow-ssh "]
}
depends_on = [“aws_security_group.allow-ssh”]
}

resource “aws_db_subnet_group” “sample” {
name = “main”
subnet_ids = ["{aws_subnet.main-public-1.id}", "{aws_subnet.main-public-2.id}"]

tags = {
Name = “main”
}
}
resource “aws_db_instance” “default” {
identifier = “mydb”
engine = “mysql”
engine_version = “5.7.19”
instance_class = “db.t2.micro”
name = “mydb”
username = “*******”
password = “********”
vpc_security_group_ids = ["${data.aws_security_group.allow.id}"]
db_subnet_group_name = “main”
parameter_group_name = “default.mysql5.7”
apply_immediately = true
allocated_storage = “20”
#iops = 1000