fix: rediscover existing OCI public subnet
This commit is contained in:
parent
5fd26fd785
commit
d84ac8ebc3
|
|
@ -3712,6 +3712,19 @@ oci_foundation_reconcile_existing() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${LAB_OCI_EXISTING_VCN_ID:-}" && -z "${LAB_OCI_EXISTING_PUBLIC_SUBNET_ID:-}" ]]; then
|
||||||
|
local discovered_public_subnet_id
|
||||||
|
discovered_public_subnet_id="$(${oci_bin} network subnet list \
|
||||||
|
--compartment-id "${LAB_OCI_COMPARTMENT_ID}" \
|
||||||
|
--vcn-id "${LAB_OCI_EXISTING_VCN_ID}" --all \
|
||||||
|
--query 'data[?"display-name"==`homelab-public-subnet`].id | [0]' \
|
||||||
|
--raw-output 2>/dev/null || true)"
|
||||||
|
if [[ -n "${discovered_public_subnet_id}" && "${discovered_public_subnet_id}" != "null" ]]; then
|
||||||
|
export LAB_OCI_EXISTING_PUBLIC_SUBNET_ID="${discovered_public_subnet_id}"
|
||||||
|
printf 'Reusing existing OCI public subnet (%s).\n' "${discovered_public_subnet_id}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Existing VCNs may outlive the local state file. Use the VCN owner
|
# Existing VCNs may outlive the local state file. Use the VCN owner
|
||||||
# compartment for discovery and avoid creating a duplicate Bastion.
|
# compartment for discovery and avoid creating a duplicate Bastion.
|
||||||
if truthy "${LAB_OCI_BASTION_ENABLED:-true}" && [[ -z "${LAB_OCI_BASTION_ID:-}" ]]; then
|
if truthy "${LAB_OCI_BASTION_ENABLED:-true}" && [[ -z "${LAB_OCI_BASTION_ID:-}" ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue