36 lines
No EOL
1.4 KiB
HCL
36 lines
No EOL
1.4 KiB
HCL
locals {
|
|
network = {
|
|
# OCIDs capturados dinamicamente via Data Source
|
|
gateway = {
|
|
internet = {
|
|
id = length(data.oci_core_internet_gateways.igws.gateways) > 0 ? data.oci_core_internet_gateways.igws.gateways[0].id : null
|
|
}
|
|
nat = {
|
|
id = length(data.oci_core_nat_gateways.ngws.nat_gateways) > 0 ? data.oci_core_nat_gateways.ngws.nat_gateways[0].id : null
|
|
}
|
|
service = {
|
|
id = length(data.oci_core_service_gateways.sgws.service_gateways) > 0 ? data.oci_core_service_gateways.sgws.service_gateways[0].id : null
|
|
all_services = {
|
|
name = data.oci_core_services.all_services.services[0].name
|
|
cidr = data.oci_core_services.all_services.services[0].cidr_block
|
|
}
|
|
object_storage = {
|
|
name = data.oci_core_services.object_storage.services[0].name
|
|
cidr = data.oci_core_services.object_storage.services[0].cidr_block
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
locals {
|
|
# 2. Conta quantos ADs existem na região
|
|
ad_count = length(data.oci_identity_availability_domains.ads.availability_domains)
|
|
|
|
# 3. Define a durabilidade: True se tiver 3 ou mais ADs, False caso contrário
|
|
is_regional = local.ad_count >= 3
|
|
|
|
# 4. Seleciona o AD: Se for regional, o OCI ignora este campo.
|
|
# Se não for, pegamos o primeiro AD da lista.
|
|
target_ad = local.is_regional ? null : data.oci_identity_availability_domains.ads.availability_domains[0].name
|
|
} |