Skip to content

Commit

Permalink
feat: BAH Azure for PG clusters (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-wong-edb authored Oct 6, 2023
1 parent 1e796f2 commit 8bad36b
Showing 1 changed file with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
terraform {
required_providers {
biganimal = {
source = "EnterpriseDB/biganimal"
version = "0.6.0"
}
random = {
source = "hashicorp/random"
version = "3.5.1"
}
}
}

resource "random_password" "password" {
length = 16
special = true
override_special = "!#$%&*()-_=+[]{}<>:?"
}

variable "cluster_name" {
type = string
description = "The name of the cluster."
}

variable "project_id" {
type = string
description = "BigAnimal Project ID"
}

resource "biganimal_cluster" "single_node_cluster" {
cluster_name = var.cluster_name
project_id = var.project_id

allowed_ip_ranges {
cidr_block = "127.0.0.1/32"
description = "localhost"
}

allowed_ip_ranges {
cidr_block = "192.168.0.1/32"
description = "description!"
}

backup_retention_period = "6d"
cluster_architecture {
id = "single"
nodes = 1
}
csp_auth = false

instance_type = "azure:Standard_D2s_v3"
password = resource.random_password.password.result
pg_config {
name = "application_name"
value = "created through terraform"
}

pg_config {
name = "array_nulls"
value = "off"
}

storage {
volume_type = "azurepremiumstorage"
volume_properties = "P1"
size = "4 Gi"
}

maintenance_window = {
is_enabled = true
start_day = 6
start_time = "03:00"
}

pg_type = "epas"
pg_version = "15"
private_networking = false
cloud_provider = "bah:azure"
read_only_connections = false
region = "eastus2"
# pe_allowed_principal_ids = [
# <example_value> # ex: "9334e5e6-7f47-aE61-5A4F-ee067daeEf4A"
# ]
}

output "password" {
sensitive = true
value = resource.biganimal_cluster.single_node_cluster.password
}

output "faraway_replica_ids" {
value = biganimal_cluster.single_node_cluster.faraway_replica_ids
}

0 comments on commit 8bad36b

Please sign in to comment.