fix: avoid unsafe OCI reconciliation changes
This commit is contained in:
parent
f72ad444ff
commit
8c17723c9c
|
|
@ -3650,13 +3650,8 @@ oci_foundation_reconcile_existing() {
|
|||
# Reuse named child compartments when a previous state file was lost or a
|
||||
# prior apply completed only partway. OCI rejects a second compartment with
|
||||
# the same name, so discover the active OCID before Terraform plans.
|
||||
for status in homelab email; do
|
||||
for status in email; do
|
||||
case "${status}" in
|
||||
homelab)
|
||||
[[ "${LAB_OCI_CREATE_COMPARTMENT:-true}" == "true" ]] || continue
|
||||
compartment_id="${LAB_OCI_COMPARTMENT_ID:-}"
|
||||
compartment_name="${LAB_OCI_COMPARTMENT_NAME:-homelab-learning}"
|
||||
;;
|
||||
email)
|
||||
[[ "${LAB_OCI_EMAIL_CREATE_COMPARTMENT:-true}" == "true" ]] || continue
|
||||
compartment_id="${LAB_OCI_EMAIL_COMPARTMENT_ID:-}"
|
||||
|
|
@ -3695,14 +3690,8 @@ oci_foundation_reconcile_existing() {
|
|||
local discovered_bastion_id
|
||||
discovered_bastion_id="$("${oci_bin}" bastion bastion list \
|
||||
--compartment-id "${bastion_compartment_id}" --all \
|
||||
--query 'data[0].id' --raw-output 2>/dev/null || true)"
|
||||
if [[ -z "${discovered_bastion_id}" || "${discovered_bastion_id}" == "null" ]]; then
|
||||
discovered_bastion_id="$("${oci_bin}" bastion bastion list \
|
||||
--compartment-id "${LAB_OCI_TENANCY_ID}" \
|
||||
--compartment-id-in-subtree true --all \
|
||||
--query "data[?name==\`${LAB_OCI_BASTION_NAME:-homelab-bastion}\`].id | [0]" \
|
||||
--raw-output 2>/dev/null || true)"
|
||||
fi
|
||||
--query "data[?name==\`${LAB_OCI_BASTION_NAME:-homelab-bastion}\`].id | [0]" \
|
||||
--raw-output 2>/dev/null || true)"
|
||||
if [[ -n "${discovered_bastion_id}" && "${discovered_bastion_id}" != "null" ]]; then
|
||||
export LAB_OCI_BASTION_ID="${discovered_bastion_id}"
|
||||
printf 'Reusing existing OCI Bastion (%s).\n' "${discovered_bastion_id}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue