Automate local Name Resolution with Terraform // DNS #2

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024

Комментарии • 67

  • @no-ml6gz
    @no-ml6gz Год назад +16

    This is really interesting! One thing I would like to see more of is that you do dual stack configuration. A lot of us use IPv6 to talk directly to our machines without the hastle of NAT!

    • @christianlempa
      @christianlempa  Год назад +2

      Thx :)

    • @borngeek666
      @borngeek666 Год назад +1

      agreed, my ISP in Thailand is handing out prefix delegation, now, and I dont have to battle CGnat ip4 - which I currently use ARGO and WARP for... Although I have backup teleport with unifi UDM-PRO. Great video, Christian! I will apply to my bind9, now :)

  • @olegfranko8675
    @olegfranko8675 Год назад +9

    Nice approach to manage the dns records together with your IAC via Terraform.
    I'm currently using terraform to manage virtual machines and an Ansible role to install and configure bind and it's zone files. As long as my Ansible inventory hosts are maintained correctly, my dns records will be as well ;)
    Greetings from Germany btw.

  • @Nosiu
    @Nosiu Год назад

    If you're big on Terraform, I think that's a great solution. I opted for Technitium DNS and wrote a small Docker app for updating through the built-in API.

  • @brianoconnell-df7kz
    @brianoconnell-df7kz Год назад

    I'm loving your content! It's right on time for me as a rebuild my labs! I would love to see you cover Hashicorp Vault for keeping Terraform/Ansible secrets!

  • @Low_Frequency_
    @Low_Frequency_ Год назад

    That's a really cool way of handling DNS records. I didn't know terraform could handle the bind config on its own.
    I use my OPNsense for DNS and create the records with a combination of terraform and ansible. I wrote a small playbook that creates an A record and several CNAME records which gets executed in my VM terraform module. That way I have the benefit of the lifecycle management from terraform plus the easy DNS setup without a dedicated VM for it. Combined with CI/CD it's just the perfect setup for a constantly changing homelab.

  • @vvagw5825
    @vvagw5825 Год назад

    I am happy to watch all your videos. And I'm learning. go go go!

  • @justarandomguy1927
    @justarandomguy1927 Год назад

    Amazing video! Very nice content, well explained and very professional. Keep it up!

  • @HackerConsole
    @HackerConsole 11 месяцев назад +3

    Hello, how do you solve the problem of creating the journal?

    • @Enrii90
      @Enrii90 11 месяцев назад +1

      Christian!! you didn't tell us how you solved it... :(

    • @jorgemrsantos
      @jorgemrsantos 7 месяцев назад

      Yeah, still waiting for that second, where you explain how to solve the permissions issue. Great video! Thank you so much for this amazing content

    • @genukawijenayake1951
      @genukawijenayake1951 Месяц назад

      i was able to fix this issue by changing the ownership of the /etc/bind file in the bind9 container. Since in the compose file, the specified user is root the ownership of the /etc/bind file inside the container should be the same. but by default this is not the case for me (was ubuntu:ubuntu). so i had to change it to root:root with (chown -R root:root /etc/bind) then reboot the container. After reinitializing terraform and applying them, everything worked just fine.

  • @DavidEsotica
    @DavidEsotica Год назад

    Seriously Christan? I was looking up this topic and you posted this 3 hours ago!

  • @cybr774
    @cybr774 Год назад

    Nice tutorial, I'll totally set this up once I have my homelab setup ready. Btw have you ever used terraform cloud? It's pretty good ngl, have you seen it's latest update that it gives you one free runner to use for on premises terraform applies through terraform cloud?

  • @hansaya
    @hansaya Год назад +2

    What I have done is use pfsense to automate DNS. I even got k3s to automatically update my dns entries

  • @wahabhabeeb8614
    @wahabhabeeb8614 Год назад

    Awesome! I am try that right away. Thanks for sharing

  • @AndrewMay-GG
    @AndrewMay-GG 9 месяцев назад

    I'm having a problem with "apparmor", when making the modification with terraform, bind returns an error when creating the file, I verified that the ubuntu image does not allow the application to write to this directory.

  • @michaelventarola7100
    @michaelventarola7100 9 месяцев назад

    I am able to add A records, but these records are not updated in my zone files. They are in a zone file with a jnl extention. How do I get thezone fles updated?

  • @CristianHeredia0
    @CristianHeredia0 23 дня назад

    This is great. What do you use for ssl certs? Can you configure bind to use cloudflare certs?

    • @christianlempa
      @christianlempa  23 дня назад

      Thanks! I'm using traefik as my reverse proxy, which also terminates TLS

  • @Vera150607
    @Vera150607 Год назад

    Adguard Home DNS + Nginx PM with a DNS forward entry from your DNS to Nginx PM containing your reverse host and bingo, all your web app with public valid ssl certificates.

  • @monsterhuntfreak2011
    @monsterhuntfreak2011 8 месяцев назад

    I just use FreeIPA for DNS Management. Once I add the server/ client to the Domain it automatically gets added as a DNS Entry

  • @youtubegarbage4u
    @youtubegarbage4u Год назад

    where is video for using letsencrypt for the apps running on the internal networks?

  • @zend112
    @zend112 Год назад

    Awesome video, I have refactored my Terraform scripts to include now the DNS A records of my hosts in my homelab. One question though: how do you generate the records for PTR records?

  • @francescolaporta9704
    @francescolaporta9704 Год назад

    Great video, interesting! Is there a web interface to insert new records into zones that interfaces with terraform+bind?

  • @ahmadmiqdaadabdulaziz6163
    @ahmadmiqdaadabdulaziz6163 Год назад

    Is there any GUI for bind9 ? something like GoDaddy DNS manager / cpanel DNS manager ? If you plan to start that project, I would love to see it

  • @EricOnYouTube
    @EricOnYouTube 7 месяцев назад

    Do you use terraform and Raspberry Pi? How?

  • @shawn2296
    @shawn2296 Месяц назад

    What a great video

  • @dnldnl4880
    @dnldnl4880 11 месяцев назад

    Excellent video

  • @user-pn2xt3jw1i
    @user-pn2xt3jw1i 3 месяца назад

    "What I really hate in the IT is manual configuration.
    So I took all the records from a huge Bind config file and put them all to another even bigger Terraform config file.
    And I made a video about it."

    • @gabe_dunn
      @gabe_dunn 23 дня назад

      You see, the things is, now that he's done this once, he won't have to touch it again. It will keep the DNS records up to date, when adding new machines, VMs, etc.
      It's definitely more upfront config, but it means you don't have to revisit it every time you want to make changes like adding a new host.

  • @bolto90
    @bolto90 Год назад +1

    how did you solve the jnl file creation

    • @ruansteyn27
      @ruansteyn27 Год назад +1

      I am also now trying to figure that part out :-)

    • @wolfbyte1555
      @wolfbyte1555 28 дней назад

      I am running the same ubuntu/bind9:latest image on an ubuntu cloud image server. Had the same issue. If you are passing in the environment variable BIND9_USER=root in your docker compose yaml, you will need to chown your three directories/contents to root on the host machine. For example, "sudo chown root:root ./config/". I also added an extra parameter to the named.conf zone: journal "/var/lib/bind/your-zone.jnl";
      Then, docker compose up -d --force-recreate. Terraform was able to apply without issue.

  • @Dwykid1
    @Dwykid1 Год назад +1

    I LITERALLY was doing this last night and ended up on a cludgy wildcard solution. Lets see if this works better!

    • @christianlempa
      @christianlempa  Год назад

      Oh nice! Tell me how it works for you ;)

    • @Dwykid1
      @Dwykid1 Год назад +1

      @@christianlempa I'll try it during my next scheduled maintenance window for my homelab (weekends)
      Yes I know I just said I messed with production on a monday night, don't pay attention to that.

  • @Michaeeeel
    @Michaeeeel Год назад

    Whats the point of trading one file system to another? i would have seen the utility in creating this dns records in some UI, otherwise it seems like I have to learn one more thing to configure 😅

    • @christianlempa
      @christianlempa  Год назад

      You need to rewatch the video, I'm explaining it somewhere in the middle ;)

  • @s.i.m.c.a
    @s.i.m.c.a Год назад +5

    so - instead of having a one huge file to upkeep, you would need to upkeep a huge amount of terraform scripts, what a smart move

    • @june012006
      @june012006 Год назад +3

      You add the dns resource to the script that builds the actual VM. If you are just updating dns records then yes, this is ridiculous, however, if you are using terraform to build and update your infrastructure, you're already maintaining these same scripts.

  • @mastergamer4335
    @mastergamer4335 Год назад

    16:38 yes it's pronounced like daymon.

  • @rolfamfelt9946
    @rolfamfelt9946 Год назад

    Don’t you have pi-hole ? And can it be updated in the same way?

    • @ilovestitch
      @ilovestitch Год назад

      May be running a pfsense DNS resolver or something more advanced, pi-hole is tonka trucks compared to some of the big rigs out there

    • @christianlempa
      @christianlempa  Год назад

      No, to both :D But you can still use bind9 together with pihole, just do a DNS forwarding :)

  • @henderstech
    @henderstech Год назад

    Would this be better than pihole dns?

    • @christianlempa
      @christianlempa  Год назад

      Depends... bind9 is just a DNS Server, PiHole also does Ad blocking.

  • @MrGarfield
    @MrGarfield Год назад

    No i would not use terraform. Just open the Zonefile, with a watch daemon CTRL+S is reload the config 🙂

  • @tdx110
    @tdx110 10 месяцев назад

    You forgot to add that you need to change one DNS in the router to our DNS address!
    That's not how it works!

  • @MestreDentistaGUC
    @MestreDentistaGUC Год назад

    Are you no longer on Odysee?!?! 😥

  • @nixxblikka
    @nixxblikka Год назад +1

    Erster 😀

  • @pprocacci
    @pprocacci Год назад

    Whether you're doing it in terraform or you editing bind records by hand, you're still doing it manually somewhere.
    You've solved absolutely nothing and added another layer on top of simply editing bind configuration files.

    • @june012006
      @june012006 Год назад

      Yes, but when you decom your vm that you built with terraform, you can delete the dns entry at the same time.

    • @tcasex
      @tcasex Год назад +1

      I think you're missing the point...this is mostly for devops, devsecops, etc. I think it's a bit ridiculous to use terraform in a home lab...but to learn the technology you need to practice it doing ridiculous things instead of fucking up a production environment.
      For instance - say you need a repeatable process of standing up infra and then destroying it when done 4 times a year. Instead of doing this manually and trying to remember what to do every quarter, you just use terraform to automate it with a known "good" config. Update the config as needed.... There is a reason it's a "Infrastructure as Code" tool. I hope I added some clarity...and thanks for sharing the video.

  • @LariviereChris
    @LariviereChris Год назад +1

    Really awesome stuff. What plug-in are you using for terraform autocomplete. I always have to go back to the documentation 🥲🤪