-
Notifications
You must be signed in to change notification settings - Fork 1
/
infra.tf
50 lines (44 loc) · 1.31 KB
/
infra.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
42
43
44
45
46
47
48
49
50
# configuration of basic infrastructure
#
#
# appy is currently an Elastic Beanstalk-deployed Docker app, dependent upon a
# separate RDS instance.
#
# management of the project is principally performed via `manage` commands;
# (and, for consistency, a `manage stack` command covers this).
#
# terraform is here in use to replace manual configuration performed via the AWS
# Console, (and could perhaps be used to replace use of AWS CLI in `manage.py`,
# as desired/useful).
#
# NOTE: But, database could also, alternatively, be managed as part of Elastic
# Beanstalk (saved) configuration....
#
terraform {
required_version = "~> 0.12.6"
}
provider "aws" {
version = "~> 2.22"
region = "us-west-2"
}
variable "appy_db_snapshot_id" {
type = string
}
resource "aws_db_instance" "default" {
identifier = "appy"
instance_class = "db.t2.medium"
parameter_group_name = "default.postgres10"
storage_encrypted = true
iam_database_authentication_enabled = true
tags = {
workload-type = "production"
}
# specified by env or shell input prompt
#
# snapshot from which to relaunch for the year
snapshot_identifier = var.appy_db_snapshot_id
# provisioned elsewhere
#
# db-dedicated subnet group in same vpc as beanstalk env
db_subnet_group_name = "dsapp-db-subnet-group"
}