SHARE
TWEET

Untitled

a guest Sep 19th, 2019 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. provider "aws" {
  2.   region = var.aws_region
  3.   profile = var.aws_profile
  4. }
  5.  
  6.  
  7. terraform {
  8.   backend "s3" {
  9.     bucket = "bharaths-terraform-up-and-running"
  10.     key = "development/data-stores/mysql/terraform.tfstate"
  11.     region = "us-east-2"
  12.     dynamodb_table = "bharaths-terraform-up-and-running-locks"
  13.     encrypt = true
  14.   }
  15. }
  16.  
  17. resource "random_string" "db_password" {
  18.   length = 16
  19.   special = true
  20.   override_special = "!#()-[]<>"
  21. }
  22.  
  23. resource "aws_db_instance" "bharaths_mysql" {
  24.   instance_class = "db.t2.micro"
  25.   identifier_prefix = "bharaths-terraform-up-and-running"
  26.   engine = "mysql"
  27.   allocated_storage = 10
  28.   name = "bharaths_example_database"
  29.   username = "bharath_admin"
  30.   skip_final_snapshot     =  true
  31.   apply_immediately = true
  32.   password = random_string.db_password.result
  33.   lifecycle {
  34.     ignore_changes = ["password"]
  35.   }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top