Assigning or unassigning a server-configuration pattern to servers
Use this definition to assign or unassign a server-configuration pattern to one or more servers.
A job is created to complete this request.
Usage
resource "lxco_configPattern" "assignPattern" {
pattern_action = string
pattern_id = string
device_ids = array of strings
group_ids = array of strings
overwrite = Boolean
force = Boolean
}
output "assignPattern" {
value = lxco_configPattern.assignPattern
}
Example
The following example assigns and unassigns a server-configuration pattern to multiple servers.
terraform {
required_providers {
lxco = {
version = "0.1"
source = "lenovo.com/xclarity/lxco"
}
}
}
provider "lxco" {
host = "192.0.2.0"
# username = ""
# password = ""
}
# Assign a server-configuration pattern to a group of servers, and return the results
resource "lxco_configPattern" "assignPattern" {
pattern_action = "assignPattern"
pattern_id = "cea06d1910002"
device_ids = []
group_ids = ["96436AB8F36411E685CB819F6B63BC85"]
overwrite = true
force = false
}
output "assignPattern" {
value = lxco_configPattern.assignPattern
}
# Unassign a server-configuration pattern from a specific server, and return the results
resource "lxco_configPattern" "assignPattern" {
pattern_action = "unassignPattern"
pattern_id = ""
device_ids = ["80CE6AB8FF7D11E685CB819F6B26BCF8"]
group_ids = []
overwrite = true
force = false
}
output "assignPattern" {
value = lxco_configPattern.assignPattern
}
Inputs
| Name | Required / Optional | Type | Description | ||
|---|---|---|---|---|---|
| pattern_action | Required | String | Action. This can be one of the following values.
| ||
| pattern_id | Required | String | Pattern ID If a pattern ID is specified, the pattern is assigned to the devices. If a set to null, the current pattern is unassigned from the devices. | ||
| device_ids | Required | Array of strings | List of UUIDs of the servers to which to assign the pattern If group_ids and device_ids attributes are both set to an empty array, the pattern is assigned to all devices. | ||
| group_ids | Required | Array of strings | List of IDs of device groups that contains one or more servers to which to assign or unassign the pattern The pattern is assigned to each server in the specified groups. Devices of other types in the group are ignored. If group_ids and device_ids attributes are both set to an empty array, the pattern is assigned to all devices. | ||
| overwrite | Optional | Boolean | Indicates whether to replace an existing pattern assignment with the specified pattern. This can be one of the following values.
| ||
| force | Optional | Boolean | Indicates whether to force the assignment if a pattern-deployment job is in progress on the server. This can be one of the following values.
| ||
Outputs
| Name | Type | Description | ||
|---|---|---|---|---|
| message | String | Status message | ||
| id | Integer | Job ID that was created to assign or unassign the pattern | ||
The following example is returned if the request is successful.
{
"id": "85",
"device_ids": [ "80CE6AB8FF7D11E685CB819F6B26BCF8" ],
"force": false,
"group_ids": [],
"overwrite": true,
"pattern_action": "assignPattern",
"pattern_id": "cea06d1910002"
}
Give documentation feedback