Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created August 20, 2023 14:42
Show Gist options
  • Save gowatana/5f83f61b184b84cc5b12807127fa6f0b to your computer and use it in GitHub Desktop.
Save gowatana/5f83f61b184b84cc5b12807127fa6f0b to your computer and use it in GitHub Desktop.
data "nutanix_ndb_cluster" "c1" {
cluster_name = "EraCluster"
}
data "nutanix_ndb_profile" "nw_profile_1" {
profile_type = "Network"
profile_name = "DEFAULT_OOB_POSTGRESQL_NETWORK"
}
data "nutanix_ndb_profile" "sw_profile_1" {
profile_type = "Software"
profile_name = "POSTGRES_10.4_OOB"
}
data "nutanix_ndb_profile" "compute_profile_1" {
profile_type = "Compute"
profile_name = "DEFAULT_OOB_SMALL_COMPUTE"
}
data "nutanix_ndb_profile" "db_profile_1" {
profile_type = "Database_Parameter"
profile_name = "DEFAULT_POSTGRES_PARAMS"
}
data "nutanix_ndb_sla" "sla1" {
sla_name = "DEFAULT_OOB_BRASS_SLA"
}
resource "nutanix_ndb_dbserver_vm" "postgres_vm_1" {
database_type = "postgres_database"
nx_cluster_id = data.nutanix_ndb_cluster.c1.id
software_profile_id = data.nutanix_ndb_profile.sw_profile_1.id
software_profile_version_id = data.nutanix_ndb_profile.sw_profile_1.latest_version_id
compute_profile_id = data.nutanix_ndb_profile.compute_profile_1.id
network_profile_id = data.nutanix_ndb_profile.nw_profile_1.id
vm_password = "nutanix/4u"
postgres_database {
vm_name = "ndb-pgdql-sv-01"
client_public_key = var.ssh_public_key
}
}
resource "nutanix_ndb_database" "postgres_1" {
databasetype = "postgres_database"
name = "pgsql-01"
createdbserver = false
dbserverid = nutanix_ndb_dbserver_vm.postgres_vm_1.id
dbparameterprofileid = data.nutanix_ndb_profile.db_profile_1.id
postgresql_info {
listener_port = 5432
database_size = 200
db_password = "nutanix/4u"
database_names = "pgsql1"
}
// ndb cluster id
nxclusterid = data.nutanix_ndb_cluster.c1.id
nodes {
dbserverid = nutanix_ndb_dbserver_vm.postgres_vm_1.id
vmname = "ndb-pgsql-sv-01"
}
timemachineinfo {
name = "pgsql-01_TM"
slaid = data.nutanix_ndb_sla.sla1.id
schedule {
snapshottimeofday {
hours = 6
minutes = 0
seconds = 0
}
continuousschedule {
enabled = true
logbackupinterval = 30
snapshotsperday = 1
}
weeklyschedule {
enabled = true
dayofweek = "WEDNESDAY"
}
monthlyschedule {
enabled = true
dayofmonth = "24"
}
quartelyschedule {
enabled = true
startmonth = "JANUARY"
dayofmonth = 24
}
yearlyschedule {
enabled = false
dayofmonth = 31
month = "DECEMBER"
}
}
}
}
@gowatana
Copy link
Author

下記の投稿むけ。

NDB で PostgreSQL DB をプロビジョニングしてみる。(Terraform 編 補足)
https://blog.ntnx.jp/entry/2023/08/20/235933

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment