Skip to content

My home config for managing Unifi home network using Terraform

Notifications You must be signed in to change notification settings

nqngo/terraform-home-network

Repository files navigation

Unifi Home Network

My Terraform-managed Unifi home network as Infrastructure as Code. Feel free to clone this repo to use as base for your project.

Please note that not all GUI functionality has been implemented yet. If you found any errors, feel free to create an issue.

Usage Notes

  1. Set up your environment variable in an .env file. See example.env for example.
  2. Terraform Cloud is used as the backend to store the tfstate. Please use terraform login and configure your backend to your own workspace.
  3. Each site is managed as a module from main.tf. Rename site-modules to your relevant site name. While it's possible to create site resource and manage it from default. It is easier to manage to hard-code the site ID directly from main.tf.
  4. Put all clients in the relevant site-*/data/$network.csv. See clients.tf.
  5. If you have existing resources, import the resource in to manage it in Terraform. For example:
env $(cat example.env | xargs) terraform import module.site-neale.unifi_user_group.d80u20 5f10563e8f7939532b7984c1
  1. The resource id can be usually parsed from the browser. For example:
https://unifi.example.com:8443/manage/site/abcdefgh/settings/usergroups/edit/5f10563e8f7939532b7984c1
  1. This codebase is written for cloud controller 5.x. Some attributes are deprecated in cloud controller 6.x, ignore any deprecation warning if you are running 5.x controller.
  2. Run terraform init each time you add a module.

About

My home config for managing Unifi home network using Terraform

Resources

Stars

Watchers

Forks