Example using Terraform
Prerequisites
Terraform version >= v1.7.0 and 64-bit install terraform.
A Greenlake API client to authenticate against UXI configuration API.
See here for more information on generating client credentials.
- Open the previously generated file using nano
uxi.tf
and addclient id
andclient secret
of UXI from the GreenLake account.
terraform {
required_providers {
hpeuxi = {
source = "HewlettPackard/hpeuxi"
version = "0.1.0-alpha.1"
}
}
}
provider "hpeuxi" {
client_id = "your_greenlake_uxi_client_id"
client_secret = "your_greenlake_uxi_client_secret"
}
- Run first Terraform Execution Plan.
The best way to get started using Terraform is to run execution plans. All Terraform plans are written in HCL (Hashicorp Configuration Language). HCL is very similar to the JSON format.
Example: Create Parent Group and Child group in the hierarchy using Terraform
Open the file using the nano uxi.tf
and copy the following code from here
terraform {
required_providers {
hpeuxi = {
source = "HewlettPackard/hpeuxi"
version = "0.1.0-alpha.1"
}
}
}
provider "hpeuxi" {
client_id = "your_greenlake_uxi_client_id"
client_secret = "your_greenlake_uxi_client_secret"
}
# Create level 1 group attached to the root node
resource "hpeuxi_group" "level_1" {
name = "Parent Group"
}
# Create level 2 group attached to level 1 group
resource "hpeuxi_group" "level_2" {
name = "Child Group"
parent_group_id = hpeuxi_group.level_1.id
}
- Run the plan using the following commands
terraform init
terraform plan
Finding the right Terraform resource/data-source
We have all the resources that can help you manage the sensors, agents, groups and tests.
We have all the data sources that can help you retrieve information from sensors, agents, groups and tests.
Please follow this link to check out all the resources and data sources.
Updated about 1 month ago