BIG-IP Infrastructure Onboarding ################################ In this section you will configure basic network configurations like NTP, DNS, and interface IP addresses. #. Confirm BIG-IP is not configured with basic network configurations. - Explore BIG-IP GUI **Network -> Self IPs** and **Network -> VLANs** settings to validate they are not configured .. image:: /_static/selfip0.png :height: 150px .. image:: /_static/vlan0.png :height: 150px #. Create **main.tf** to use the `[Terraform Provider for F5 BIG-IP] `__ - Open client server **vscode terminal** - ``mkdir ~/projects/lab1`` - ``cd ~/projects/lab1`` - ``touch main.tf`` - use vscode to add the following code to **main.tf** .. code:: json terraform { required_providers { bigip = { source = "F5Networks/bigip" version = "1.3.1" } } } provider "bigip" { address = "10.1.1.6" username = "admin" password = "F5d3vops$" } resource "bigip_command" "showversion" { commands = ["show sys version"] } output "showversion" { value = "${bigip_command.showversion.command_result}" } .. image:: /_static/maintf.png :height: 300px #. Test terraform connectivity to bigip - ``terraform init`` .. image:: /_static/tinit.png :height: 300px .. NOTE:: The `terraform init `__ command is used to initialize a working directory containing Terraform configuration files. This is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control. It is safe to run this command multiple times. - ``terraform plan`` .. image:: /_static/tplan.png :height: 300px .. NOTE:: The `terraform plan `__ command is used to create an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files. - ``terraform apply`` .. image:: /_static/tapply.png :height: 300px - Type ``yes`` to approve action when prompted .. NOTE:: The `terraform apply `__ command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan. In addition **terraform.tfstate** file is created by Terraform to map real world resources to your configuration, keep track of metadata, and to improve performance for large infrastructures. #. Create **f5base.tf** to configure base bigip network (NTP, DNS, VLANS and SELFIPs) - ``touch f5base.tf`` - use **vscode** to add the following code to **f5base.tf** .. code:: json resource "bigip_sys_ntp" "ntp1" { description = "/Common/NTP1" servers = ["time.google.com"] timezone = "America/Los_Angeles" } resource "bigip_sys_dns" "dns1" { description = "/Common/DNS1" name_servers = ["8.8.8.8"] number_of_dots = 2 search = ["f5.com"] } resource "bigip_net_vlan" "vlan1" { name = "/Common/internal" interfaces { vlanport = 1.1 tagged = false } } resource "bigip_net_vlan" "vlan2" { name = "/Common/external" interfaces { vlanport = 1.2 tagged = false } } resource "bigip_net_selfip" "selfip1" { name = "/Common/internalselfIP" ip = "10.1.10.6/24" vlan = "/Common/internal" depends_on = [bigip_net_vlan.vlan1] } resource "bigip_net_selfip" "selfip2" { name = "/Common/externalselfIP" ip = "10.1.20.6/24" vlan = "/Common/external" depends_on = [bigip_net_vlan.vlan2] } - ``terraform plan`` - ``terraform apply`` .. image:: /_static/f5base.png :height: 300px .. NOTE:: The **bigip terraform provider** contains native resources to help facilitate provisioning services on BIG-IPs. For example `bigip_sys_ntp `__ resource is helpful when configuring NTP server on the BIG-IP. #. Confirm BIG-IP is now configured - Refresh firefox browser and explore BIG-IP GUI **Network -> Self IPs** and **Network -> VLANs** to validate network settings are now configured .. image:: /_static/selfip.png :height: 150px .. image:: /_static/vlan.png :height: 150px