This topic is to discuss the following lesson:
Hi Rene ,
How do I set up the interface between my Cisco ASR920 and the Terraform platform?
BR//ZAMAN
Hello Zaman
In the lesson, by enabling RESTCONF and the HTTPS service on the router, Terraform is able to use the RESTCONF API to communicate with the router. If you want to find out how that connection is made, take a look at the RESTCONF section of this lesson here:
Once this is complete, Terraform will use HTTPS to communicate with the router, with the use of a URL as shown in the above lesson.
I hope this has been helpful!
Laz
Hello Laz,
Could you please explain what is AWS EC2 is it virtual machine or some component of VM or what exactly ?
Also as the lesson above we showed Rene worked in terraform on left and visual Studio on right my question, Is terraform works just by opening the terminal or do we have to do some setting ups to initialize Terraform, Also how the communication happened between the terminal and the Visual Studio as Rene were running the commands and script in each separately?
Regards.
Hello Ahmedlmad
AWS EC2 refers to Amazon’s Elastic Compute Cloud, which is part of Amazon’s cloud-computing platform, Amazon Web Services (AWS). Specifically, the EC2 is a VM that you can configure and “rent” based on the resources that you specify, and you can run your own applications on. More info about this can be found here:
Now, Rene, in his video, has shown two windows, one with Terraform and one with Visual Studio. Both of these run locally on the windows machine. As far as Terraform goes, when you define the resources you want, that’s when you specify how to connect to an AWS EC2 instance. This is done within the main.tf file. You must also download the required provider plugin using the Terraform init command using that info in the main.tf file.
Once that’s done, then your Terraform terminal is connected to your AWS resource. This is all shown within the lesson.
Now how about the interaction between Visual Studio and Terraform? VS Code is simply used to edit the Terraform config files (.tf files). There’s no direct integration or communication between the programs. VS Code is simply used as an editor. Does that make sense?
If you try out the lab and perform the steps one by one it should become clearer as to how this works and how the various parts interact.
I hope this has been helpful!
Laz
Hello Dear,
Thanks for the awesome explanation of tf in this lesson, however for the cisco configuration I have recently used Netmiko tool to automate some configuration in the network, In fact i see it much easier to apply scripts compared to Terraform which needs pre preparations such as mentioned in the lesson as enabling REST and HTTPS, could you please explain me if I’m right in what I did mention, also what would be the main differences/advantages in using Terraform for Cisco over Netmiko way? and why would i use Terraform even if an easier tool is there such as Netmiko.
Best regards.
Hello Ahmedlmad
That’s an excellent question, and it gets to the very heart of why we have different tools for network automation. Your observation is completely valid. For making a quick, targeted configuration change, Netmiko is often faster and more direct.
But Netmiko and Terraform are two different tools that have somewhat different purposes. Sure they overlap in some areas, but the underlying principle is different.
Netmiko, is known as an “imperative” tool. You tell it how to achieve a result. You write a script of sequential CLI commands. It does what it is told to do.
Terraform is known as a “declarative” tool. You tell it what you want the end result to be. You define the desired state in a configuration file, and Terraform figures out how to get there. It has a level of intelligence, and that’s also why it’s called an Infrastructure as Code or IaC tool or a provisioning tool.
So, although Netmiko is suited for automation that you define explicitly, Terraform adds a layer of intelligent abstraction that allows it to decide how to achieve what you are defining.
You are right, Netmiko is a great tool and is often easier for direct, imperative tasks. Terraform is more like a full-scale architectural blueprint and automated construction system. It requires more setup but provides many safeguards and enhancements in the process, such as safety, scale, and lifecycle management for your infrastructure.
Learning both is a huge asset. You’ll find yourself using Netmiko for your daily operational tasks and Terraform for your larger architectural and lifecycle management needs.
I hope this has been helpful!
Laz