How to create a RDS (AWS) MySQL - Database using Terraform
This article has not been completed yet. However, it may already contain helpful information and therefore it has been published at this stage.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
provider "aws" {
profile = "default"
region = "eu-central-1"
}
resource "aws_db_instance" "itinfrasoldb" {
allocated_storage = 20
engine = "mysql"
engine_version = "5.7"
instance_class = "db.t2.micro"
name = var.db_name
username = "admin"
password = var.db_password
parameter_group_name = "default.mysql5.7"
}
variable "db_name" {
type = string
}
variable "db_password" {
type = string
sensitive = true
}
db_name = "itinfrasolmysqldb"
db_password = "test123456"
terraform init
terraform plan --var-file=secrets.tfvars
terraform apply --var-file=secrets.tfvars