Hax: Default to Google DNS if CONSUL_DNS_IP doesn't exist
The CONSUL_DNS_IP env variable doesn't exist in Buildkite, and doesn't
really make sense at the moment in AWS. Since this is going away
somewhat shortly once the fix is merged into Nomad, this is a temporary
fix.
@@ -27,7 +27,9 @@ HOST_IP_IN_NOMAD: Final[str] = "${attr.unique.network.ip-address}"
# This is equivalent to what "${attr.unique.network.ip-address}" resolves to but is used for cases where variable
# interpolation is not available such as network.dns prior to Nomad 1.3.0
-CONSUL_DNS_IP: Final[str] = os.environ["CONSUL_DNS_IP"]
+# Hax: If this is not available such as in Buildkite, we'll default to Google DNS for now.
+# This should be going away once https://github.com/hashicorp/nomad/pull/12817 is merged
+CONSUL_DNS_IP: Final[str] = os.getenv("CONSUL_DNS_IP", "8.8.8.8")
def to_bool(input: Optional[Union[str, bool]]) -> Optional[bool]:
