From 0571509ad1672a7e339404b66205bd874765d540 Mon Sep 17 00:00:00 2001 From: Anuj Sharma Date: Thu, 25 Apr 2024 11:55:56 +0530 Subject: [PATCH] Create main.tf --- rds_terraform/main.tf | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 rds_terraform/main.tf diff --git a/rds_terraform/main.tf b/rds_terraform/main.tf new file mode 100644 index 0000000..87e6b6b --- /dev/null +++ b/rds_terraform/main.tf @@ -0,0 +1,28 @@ +// rds.tf + +resource "aws_security_group" "example" { + name_prefix = "example-" + ingress { + from_port = 0 + to_port = 3306 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } +} + +resource "aws_db_instance" "example" { + engine = "mysql" + db_name = "example" + identifier = "example" + instance_class = "db.t2.micro" + allocated_storage = 20 + publicly_accessible = true + username = var.db-username + password = var.db-password + vpc_security_group_ids = [aws_security_group.example.id] + skip_final_snapshot = true + + tags = { + Name = "example-db" + } +}