You need VLAN 20 on SW1, SW2, and SW3.
You add it on each switch, one by one.
Figure 1 - One Switch at a Time
You forgot SW3, and nothing tells you.
The configuration only exists on the switches.With infrastructure as code (IaC), you describe your network configuration in a machine-readable file instead of configuring devices manually.
A tool reads this file and applies the configuration to every device.
Figure 2 - Infrastructure as Code
Answer the question below
With IaC, where do you describe the configuration?
You store the file in Git, like your code.
Git gives you three benefits:You see who changed the file, and when.
A teammate can review a change before it is applied.
You can go back to an older version.
The file in Git is the source of truth: it defines how the network must be configured.
The tool reads this file from Git and applies the configuration to SW1, SW2, and SW3.
Figure 3 - The File in Git Is the Source of Truth
You edit the file instead of changing the device manually.
Manual changes on a switch cause configuration drift, which is a mismatch between the device and the file.Answer the question below
Which tool keeps the history of the file?
The file is declarative: it describes the result you want, not the steps.
The opposite is an imperative script: it lists every step needed to reach that result.
Figure 4 - Imperative and Declarative
In this example, the file says that VLAN 20 must exist with the name USERS.
It does not list the steps to run: the tool handles them.Answer the question below
Which word describes a file that gives the result: declarative or imperative?
You can apply the same file many times.
If VLAN 20 already exists with that name, the tool changes nothing.
Figure 5 - Two Runs, One Result
This property is called idempotence.
The result is the same after one run or after ten runs.In the next lessons, you will use this approach with Ansible and Terraform.
Answer the question below
You apply the same file two times. How many times is VLAN 20 created?