-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
41 lines (34 loc) · 1.7 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ---------------------------------------------------------------------------------------------------------------------
# A SIMPLE EXAMPLE OF HOW TO DEPLOY MYSQL ON RDS
# This is an example of how to use Terraform to deploy a MySQL database on Amazon RDS.
#
# Note: This code is meant solely as a simple demonstration of how to lay out your files and folders with Terragrunt
# in a way that keeps your Terraform code DRY. This is not production-ready code, so use at your own risk.
# ---------------------------------------------------------------------------------------------------------------------
terraform {
# Live modules pin exact Terraform version; generic modules let consumers pin the version.
# The latest version of Terragrunt (v0.36.0 and above) recommends Terraform 1.1.4 or above.
required_version = ">= 1.1.4"
# Live modules pin exact provider version; generic modules let consumers pin the version.
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.67.0"
}
}
}
# ---------------------------------------------------------------------------------------------------------------------
# CREATE THE MYSQL DB
# ---------------------------------------------------------------------------------------------------------------------
resource "aws_db_instance" "mysql" {
engine = "mysql"
engine_version = "5.6.41"
name = var.name
username = var.master_username
password = var.master_password
instance_class = var.instance_class
allocated_storage = var.allocated_storage
storage_type = var.storage_type
# TODO: DO NOT COPY THIS SETTING INTO YOUR PRODUCTION DBS. It's only here to make testing this code easier!
skip_final_snapshot = true
}