-
Notifications
You must be signed in to change notification settings - Fork 1
/
database.tf.good
48 lines (39 loc) · 916 Bytes
/
database.tf.good
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
42
43
44
45
46
47
48
provider "aws" {
region = "us-east-1"
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
}
resource "aws_s3_bucket" "terraform_state" {
bucket = "terraform-test-jose"
versioning {
enabled = true
}
lifecycle {
prevent_destroy = false
}
}
resource "aws_db_instance" "example" {
engine = "mysql"
allocated_storage = 10
instance_class = "db.t2.micro"
name = "example_database"
username = "admin"
password = "${var.db_password}"
skip_final_snapshot = true
}
output "address" {
value = "${aws_db_instance.example.address}"
}
output "port" {
value = "${aws_db_instance.example.port}"
}
/*
data "terraform_remote_state" "db" {
backend = "s3"
config {
bucket = "(YOUR_BUCKET_NAME)"
key = "stage/data-stores/mysql/terraform.tfstate"
region = "us-east-1"
}
}
*/