Created
February 5, 2020 13:20
-
-
Save dedunumax/932b707caa3a5a5a3736dcdce326e6c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_db_instance" "mydb" { | |
engine = "mysql" | |
engine_version = "5.6.40" | |
instance_class = "db.t1.micro" | |
name = "initial_db" | |
username = "example" | |
password = "1234" | |
allocated_storage = "20" | |
publicly_accessible = "true" | |
} | |
output "username" { | |
value = "${aws_db_instance.mydb.username}" | |
} | |
output "address" { | |
value = "${aws_db_instance.mydb.address}" | |
} | |
resource "null_resource" "test" { | |
depends_on = ["aws_db_instance.mydb"] #wait for the db to be ready | |
provisioner "local-exec" { | |
command = "mysql -u ${aws_db_instance.mydb.username} -p${aws_db_instance.mydb.password} -h ${aws_db_instance.mydb.address} -e \"CALL mysql.rds_set_configuration('binlog retention hours', 24);\" " | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment