infracloud/archives/invista-nexus_Fix-Unauthorized/modules/postgresql/postgresql.tf
2026-03-09 15:02:41 -03:00

45 lines
No EOL
1.4 KiB
HCL

resource "oci_psql_db_system" "postgresql_db" {
display_name = "${var.postgresql_name}"
compartment_id = var.postgresql_compartment_id
db_version = "${var.postgresql_version}"
# Shape do banco de dados (Flex permite ajustar OCPUs e Memória)
shape = "${var.postgresql_shape}"
# Configurações para shape Flex
instance_ocpu_count = var.postgresql_ocpu_count
instance_memory_size_in_gbs = var.postgresql_memory_in_gbs
# Quantidade de nós (1 para dev/single, ou mais para Alta Disponibilidade)
instance_count = var.postgresql_instance_count
# Tipo de sistema de armazenamento de alta performance do OCI
system_type = "OCI_OPTIMIZED_STORAGE"
storage_details {
system_type = "OCI_OPTIMIZED_STORAGE"
is_regionally_durable = local.is_regional
# Só será preenchido se is_regional for false
availability_domain = local.target_ad
}
network_details {
# Se usa existente, pega a var; se não, pega o ID da subnet criada acima
subnet_id = oci_core_subnet.postgresql_subnet.id
}
credentials {
username = "admin_${replace(var.postgresql_name, "-", "")}"
password_details {
password_type = "PLAIN_TEXT"
# O Terraform vai ler a senha gerada e aplicá-la na criação do banco
password = random_password.psql_admin_password.result
}
}
freeform_tags = {
"ManagedBy" = "Terraform"
}
}