Using the XClarity Orchestrator provider for Terraform
Using the Terraform
To use the XClarity Orchestrator provider for Terraform, you must declare the provider in the Terraform configuration using the inputs
terraform {
required_providers {
lxco = {
source = "lenovo.com/xclarity/lxco"
version = ""
}
}
}
provider "lxco" {
host = ""
username = ""
password = ""
}
For example:
terraform {
required_providers {
lxco = {
source = "lenovo.com/xclarity/lxco"
version = "0.1"
}
}
}
provider "lxco" {
host = "192.0.2.0"
username = "lxco_admin"
password = "********"
}
For more information about using Terraform and the Terraform configuration language, see the HashiCorp Terraform website.
Specifying credential
Credentials can be specified in the following ways.
- Use credentials from the XClarity Orchestrator’s security vault.
- Create TF_VAR_username and TF_VAR_password environment variables to specify your credentials. Terraform searches the environment of its own process for environment variables named “TF_VAR_” followed by the name of a declared variable and then matches the variable name exactly as given in configuration.
- In the main.tf file, comment out the declared variables for the credentials.
provider "lxco" {
host = "192.0.2.0"
# username = ""
# password = ""
} - From the Terraform console, create the environment variables.
$ terraform init
$ export TF_VAR_username=LXCA_USER
$ export TF_VAR_password=*password*
$ terraform plan
provider.lxco.password
Enter a value: *password*
provider.lxco.username
Enter a value: LXCA_USER
$ terraform apply
provider.lxco.password
Enter a value: *password*
provider.lxco.username
Enter a value: LXCA_USER
- In the main.tf file, comment out the declared variables for the credentials.
Give documentation feedback