Course outlines for learning terraform.
| expected time | requirements |
|---|---|
| 60 minutes | a computer |
Goal: Learn how to create GCP SQL server and instance resources using Terraform.
There are many GCP resources available, lets setup a managed MySQL instance.
Using the sql_database_instance and sql_database we’re going to create a managed MySQL database.
Use the example code and use the settings:
database_version to “MYSQL_8_0” for the google_sql_database.default.google_sql_database_instance.default.charset to “koi8u”.Use the documentation to create a database with these characteristics:
charset = “koi8u”.collation = “utf32_general_ci”Add variables for charset and collation.
Add validation on the variables so that you can only pick supported values.
Add a user to the database instance so you test MySQL later.
Most machines have telnet installed: telnet YOUR_FQDN 3306.
Some machines have mysql installed: mysql -u YOUR_USER -p -h YOUR_FQDN.
| GCP |
database_version?database_version to this resource?deletion_protection=true. 2. Change deletion_protection to false, 3 Run terraform destroy.