Creating a Service Group on NSX-T with Terraform: A Step-by-Step Guide
If you are looking to automate the creation of a service group on NSX-T using Terraform, you have come to the right place. In this blog post, we will guide you through the process of creating a service group on NSX-T with Terraform, and how to log in with a local account to your NSX-T which is integrated with VIDM.
Before we begin, let’s take a look at the example code for creating a service group on NSX-T with Terraform:
“`
resource “nsxt_policy_service” “SRV-GRP-TCP-P-1024-To-1064-443-22” {
display_name = “SRV-GRP-TCP-P-1024-To-1064-443-22”
l4_port_set_entry {
display_name = “SRV-TCP-P-1024-To-1064”
protocol = “TCP”
destination_ports = [“1024-1064”]
}
l4_port_set_entry {
display_name = “SRV-TCP-P-443”
protocol = “TCP”
destination_ports = [“443”]
}
l4_port_set_entry {
display_name = “SRV-TCP-P-22-ssh”
protocol = “TCP”
destination_ports = [“22”]
}
}
“`
This code defines a service group called “SRV-GRP-TCP-P-1024-To-1064-443-22” with three L4 port set entries: one for TCP ports 1024-1064, one for TCP port 443, and one for TCP port 22 (SSH).
Now, let’s discuss how to log in with a local account to your NSX-T which is integrated with VIDM.
Logging in with a Local Account to Your NSX-T
——————————————–
To log in with a local account to your NSX-T, you will need to have the NSX-T manager installed on your system. Once you have the manager installed, you can follow these steps:
1. Open the NSX-T manager and click on “Log In” in the top right corner of the screen.
2. Enter your email address and password for your local account.
3. Click “Log In” to access your NSX-T system.
Once you have successfully logged in with your local account, you can use Terraform to create a service group on your NSX-T system. To do this, you will need to install the Terraform provider for NSX-T and then use the following code to define your service group:
“`
resource “nsxt_policy_service” “SRV-GRP-TCP-P-1024-To-1064-443-22” {
display_name = “SRV-GRP-TCP-P-1024-To-1064-443-22”
l4_port_set_entry {
display_name = “SRV-TCP-P-1024-To-1064”
protocol = “TCP”
destination_ports = [“1024-1064”]
}
l4_port_set_entry {
display_name = “SRV-TCP-P-443”
protocol = “TCP”
destination_ports = [“443”]
}
l4_port_set_entry {
display_name = “SRV-TCP-P-22-ssh”
protocol = “TCP”
destination_ports = [“22”]
}
}
“`
This code defines a service group called “SRV-GRP-TCP-P-1024-To-1064-443-22” with three L4 port set entries: one for TCP ports 1024-1064, one for TCP port 443, and one for TCP port 22 (SSH).
Conclusion
———-
In this blog post, we have covered how to create a service group on NSX-T with Terraform, as well as how to log in with a local account to your NSX-T which is integrated with VIDM. By following these steps, you can automate the creation of service groups on your NSX-T system using Terraform, and easily access your NSX-T system with a local account.
We hope this blog post has been helpful! If you have any questions or need further assistance, please don’t hesitate to reach out to us.