About Roxy-WI Terraform provider
Terraform is an open-source tool developed by HashiCorp that allows users to define and manage infrastructure using code. It supports multiple cloud providers and on-premises environments, making it a versatile solution for automating the deployment and management of resources.
Terraform is primarily used for:
- Automating Infrastructure Management. It allows users to create, modify, and manage resources such as virtual machines, networks, and databases through declarative code.
- Infrastructure as Code. By storing configurations in text files, Terraform simplifies versioning and collaboration.
- Multi-Provider Support. Terraform can work with various cloud providers, such as AWS, Azure, and Google Cloud, as well as on-premises solutions.
- State Management. Terraform maintains the current state of the infrastructure in a state file, which is crucial for tracking changes and managing resources more efficiently.
You can use the Roxy-WI provider to interact with the many resources supported by Roxy-WI: channels, groups, servers, UDP listeners, etc.
To get started:
- Download and install Terraform using the instructions from the official website.
- Create a configuration file with a .tf extension. It is in these files that the infrastructure is created and managed.
- In order to install the Roxy-WI provider, copy and paste the following code into your Terraform configuration:
terraform {
required_providers {
roxy-wi = {
source = "roxy-wi/roxy-wi"
version = "1.0.1"
}
}
}
provider "roxy-wi" {
# Configuration options
}
Then, run terraform init, and wait for a message that the initialization was successful.
Let’s create a server using Terraform as an example.
1. Create a configuration file with a .tf extension and paste the following code:
provider "roxywi" {
base_url = "https://..."
login = "test"
password = "testpass"
}
resource "roxywi_server" "example" {
cred_id = 2
description = "test server"
enabled = true
group_id = 1
hostname = "d-infra-redis01"
ip = "192.168.1.101"
port = 5673
}
where:
- base_url — URL to connect for Roxy-WI (e.g. https://demo.roxy-wi.org);
- login — your Roxy-WI username;
- password — your Roxy-WI account password;
- cred_id — credentials ID;
- description — description of the server;
- enabled — specify whether the server should be enabled (true or false);
- group_id — ID of the group to which the server will belong;
- hostname — hostname of the server;
- IP — the server's IP address;
- port — the port number for the SSH connection.
2. Save the file and close it.
3. Run the terraform init command initialize the configuration.
In order to check if the configuration is correct, run the following command:
terraform validate
If the configuration is valid, Terraform will display the message “Success! The configuration is valid”.
For more use cases, please refer to the Roxy-WI Terraform documentation.