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

25 lines
No EOL
709 B
HCL

resource "random_integer" "suffix" {
min = 1000
max = 9999
# Opcional: O 'keepers' força a geração de um novo número
# apenas quando o nome do cluster mudar.
keepers = {
cluster_name = var.redis_name
}
}
resource "oci_vault_secret" "redis_endpoint_secret" {
compartment_id = var.redis_compartment_id
vault_id = var.vault_id
key_id = var.master_key_id
secret_name = "redis-endpoint-${var.redis_name}-${random_integer.suffix.result}"
description = "Endpoint de conexao do Redis (IP:Porta)"
secret_content {
content_type = "BASE64"
content = base64encode("${oci_redis_redis_cluster.cluster_redis.primary_endpoint_ip_address}:6379")
}
}