diff --git a/examples/digital-ocean/.terraform.lock.hcl b/examples/digital-ocean/.terraform.lock.hcl new file mode 100644 index 00000000..90411861 --- /dev/null +++ b/examples/digital-ocean/.terraform.lock.hcl @@ -0,0 +1,26 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/digitalocean/digitalocean" { + version = "2.36.0" + constraints = "~> 2.36" + hashes = [ + "h1:RJRiSKNguA33LlEZ2KmK7EpvogdV8lUVlCD5M8lVqtE=", + "zh:023d11f654e4049e80254d8edb950f6c84c993134c8ffb5ec09a71e77f486cbe", + "zh:1aa4d213d18c06df0d791aa154188517ea3efaac69f14e2de3f8e152961e22fd", + "zh:1c6adfc92a8b450ff915e5c449b3f6d0e5736c10250327467333003e119005e8", + "zh:271adfcf7a9d57bb0916118e1d6b04fba2b7730db583a654821d575f5581266e", + "zh:42bc0912cd2ab539cacb40aa22ca107306e6e16d0d6544237d93c62223c7f3ac", + "zh:5083fb44847461a3839eec222540283f2cb5db71beab0581c1ac26a2c8ed2a61", + "zh:561e5e85a3f443f93f49b8b4013f3674dc291a6b48a2ef11e055f9c07d2b5c7b", + "zh:57cef0755470862dcda9294629649e643657b86e36f2272ce75413c14614d5de", + "zh:7a31ae9c07984a9cc1b23d1d4e0df247f52dcf9be52052cdfb6bf70eeb924e56", + "zh:8176d64c4c3ce75c81f91bf508f021708d92e5326a025f5ea98b5988983617c9", + "zh:829375a4b78f956e418d5e18dd8972db430111617304d84dda38114eaf9e41e0", + "zh:8c68d7a0e6ad9684227b35aa050e2217f50424d89fd85fc48316c2b106d98158", + "zh:b109589e5462b5749993453e0f0d6a46f96b1e5c4eaecd3ba6a66e41cdd7d49e", + "zh:b3c1a8af6f29a7e671fce29eca56f00e057d416b5bfc46c1a7efa4c6863956b1", + "zh:ee8bea37be084a438870b72b0974c0f53476d045b813f9c222aec73012caa831", + "zh:ef95d44d8f70de4091c7714c3e261666106a366ab291349d98cdea72be043dc9", + ] +} diff --git a/examples/digital-ocean/main.tf b/examples/digital-ocean/main.tf new file mode 100644 index 00000000..35eb8c03 --- /dev/null +++ b/examples/digital-ocean/main.tf @@ -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 +} diff --git a/examples/digital-ocean/terraform.tf b/examples/digital-ocean/terraform.tf index e18b3fcc..3c8dfdeb 100644 --- a/examples/digital-ocean/terraform.tf +++ b/examples/digital-ocean/terraform.tf @@ -1,5 +1,12 @@ terraform { required_version = "~> 1.7" - + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = "~> 2.36" + } + } backend "local" {} } + +provider "digitalocean" {} diff --git a/examples/digital-ocean/variables.tf b/examples/digital-ocean/variables.tf new file mode 100644 index 00000000..9872f2fa --- /dev/null +++ b/examples/digital-ocean/variables.tf @@ -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" +}