-
Notifications
You must be signed in to change notification settings - Fork 8
/
infrastructure.tf
64 lines (54 loc) · 1.32 KB
/
infrastructure.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
variable "project" {}
variable "postgres_user" {
default = "airflow"
}
variable "postgres_pw" {
default = "airflow"
}
variable "region" {
default = "us-central1"
}
variable "zone" {
default = "us-central1-f"
}
provider "google" {
version = "~> 1.5"
project = "${var.project}"
region = "${var.region}"
}
resource "google_compute_global_address" "airflow-static-ip" {
name = "airflow-static-ip"
}
resource "google_compute_disk" "airflow-redis-disk" {
name = "airflow-redis-disk"
type = "pd-ssd"
size = "200"
zone = "${var.zone}"
}
resource "google_sql_database_instance" "airflow-db" {
name = "airflow-db"
database_version = "POSTGRES_9_6"
region = "${var.region}"
settings {
tier = "db-g1-small"
}
}
resource "google_sql_database" "airflow-schema" {
name = "airflow"
instance = "${google_sql_database_instance.airflow-db.name}"
}
resource "google_sql_user" "proxyuser" {
name = "${var.postgres_user}"
password = "${var.postgres_pw}"
instance = "${google_sql_database_instance.airflow-db.name}"
host = "cloudsqlproxy~%"
}
resource "google_container_cluster" "airflow-cluster" {
name = "airflow-cluster"
zone = "${var.zone}"
initial_node_count = "1"
node_config {
machine_type = "n1-standard-4"
oauth_scopes = ["https://www.googleapis.com/auth/devstorage.read_only"]
}
}