### Configure Authentication Methods Source: https://search.opentofu.org/provider/filipowm/unifi/latest Set up the provider using either an API Key or traditional username/password credentials. ```hcl # Using API Key (recommended for newer controllers) provider "unifi" { api_key = var.api_key api_url = var.api_url allow_insecure = var.insecure } # Using Username/Password (backward compatible) provider "unifi" { username = var.username password = var.password api_url = var.api_url allow_insecure = var.insecure } ``` -------------------------------- ### Configure UniFi Provider with Username/Password Source: https://search.opentofu.org/provider/filipowm/unifi/latest Use this configuration for traditional username and password authentication. ```hcl provider "unifi" { username = var.username # optionally use UNIFI_USERNAME env var password = var.password # optionally use UNIFI_PASSWORD env var api_url = var.api_url # optionally use UNIFI_API env var # you may need to allow insecure TLS communications unless you have configured # certificates for your controller allow_insecure = var.insecure # optionally use UNIFI_INSECURE env var # if you are not configuring the default site, you can change the site # site = "foo" or optionally use UNIFI_SITE env var } ``` -------------------------------- ### Configure the UniFi Provider Source: https://search.opentofu.org/provider/filipowm/unifi/latest Add the required provider block to your configuration to initialize the UniFi provider. ```hcl terraform { required_providers { unifi = { source = "filipowm/unifi" version = "1.1.0" } } } provider "unifi" { # Configuration options } ``` -------------------------------- ### Configure Provider Source Source: https://search.opentofu.org/provider/filipowm/unifi/latest Update the required_providers block to point to the filipowm/unifi source. ```hcl terraform { required_providers { unifi = { source = "filipowm/unifi" version = "~> 0.0.1" # Use the latest version } } } ``` -------------------------------- ### Configure UniFi Provider with API Key Source: https://search.opentofu.org/provider/filipowm/unifi/latest Use this configuration for secure API Key authentication, which is recommended for controller versions 9.0.108 or later. ```hcl provider "unifi" { api_key = var.api_key # optionally use UNIFI_API_KEY env var api_url = var.api_url # optionally use UNIFI_API env var # you may need to allow insecure TLS communications unless you have configured # certificates for your controller allow_insecure = var.insecure # optionally use UNIFI_INSECURE env var # if you are not configuring the default site, you can change the site # site = "foo" or optionally use UNIFI_SITE env var } ``` -------------------------------- ### Import Existing Resources Source: https://search.opentofu.org/provider/filipowm/unifi/latest Use the terraform import command to reconcile state for resources that have been updated or enhanced. ```bash # Example: Re-importing a network resource terraform import unifi_network.my_network 5dc28e5e9106d105bdc87217 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.