From 9bd4fffa50fecea18c26021ed8f9fe029f4590b6 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Fri, 5 Nov 2021 22:28:39 +0100
Subject: [PATCH] fix(terraform): Adjust boot template to produce functioning
 DNS

Currently the resolv.conf was deleted but not properly replaced. This
patch adjust that and makes sure things are put in the right place.
---
 terraform/templates/cloud-init.tpl | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/terraform/templates/cloud-init.tpl b/terraform/templates/cloud-init.tpl
index a307a28ee..617ddc4a4 100644
--- a/terraform/templates/cloud-init.tpl
+++ b/terraform/templates/cloud-init.tpl
@@ -29,15 +29,16 @@ sysctl --system
 
 dnf install -y iptables
 
+# Disable systemd-resolved for CoreDNS
+rm -f /etc/resolv.conf
+cp /run/systemd/resolve/resolv.conf /etc/resolv.conf
+systemctl disable --now systemd-resolved
+
 # Prepare NetworkManager for Calico
 cat <<EOF | sudo tee /etc/NetworkManager/conf.d/calico.conf
 [keyfile]
 unmanaged-devices=interface-name:cali*;interface-name:tunl*;interface-name:vxlan.calico;interface-name:wireguard.cali
 EOF
-
-# Disable systemd-resolved for CoreDNS
-systemctl disable --now systemd-resolved
-rm -f /etc/resolv.conf
 systemctl restart NetworkManager
 
 reboot
-- 
GitLab