Skip to content

Commit

Permalink
build(do): add database and user
Browse files Browse the repository at this point in the history
Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino committed Mar 29, 2024
1 parent 5e7473f commit bb06133
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
26 changes: 26 additions & 0 deletions examples/digital-ocean/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions examples/digital-ocean/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "digitalocean_vpc" "rciam" {
name = "rciam-${var.deployment_name}"
region = var.region
}

resource "digitalocean_database_cluster" "rciam" {
name = "rciam-db-${var.deployment_name}"
engine = "pg"
version = var.pg_version
region = var.region
node_count = 1
size = var.db_size
}

resource "digitalocean_database_user" "rciam" {
name = var.db_user
cluster_id = digitalocean_database_cluster.rciam.id
}
9 changes: 8 additions & 1 deletion examples/digital-ocean/terraform.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
terraform {
required_version = "~> 1.7"

required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.36"
}
}
backend "local" {}
}

provider "digitalocean" {}
29 changes: 29 additions & 0 deletions examples/digital-ocean/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "deployment_name" {
type = string
description = "Name of the deployment of this instance"
default = "default"
}

variable "region" {
type = string
description = "Name of the DigitalOcean region we are creating the VPC in"
default = "ams3"
}

variable "pg_version" {
type = string
description = "Postgres version of managed DB"
default = "11"
}

variable "db_size" {
type = string
description = "Instance size for PostgreSQL db."
default = "db-s-1-vcpu-1gb"
}

variable "db_user" {
type = string
description = "Username to connect to DB"
default = "postgres"
}

0 comments on commit bb06133

Please sign in to comment.