redfish_storage data source
redfish_storage (Data Source)
This Terraform datasource is used to query existing storage details from iDRAC. The information fetched from this block can be further used for resource block.
Example Usage
variables.tf
/*
Copyright (c) 2021-2024 Dell Inc., or its subsidiaries. All Rights Reserved.
Licensed under the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
variable "rack1" {
type = map(object({
user = string
password = string
endpoint = string
ssl_insecure = bool
}))
}
terraform.tfvars
/*
Copyright (c) 2023 Dell Inc., or its subsidiaries. All Rights Reserved.
Licensed under the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
rack1 = {
"my-server-1" = {
user = "admin"
password = "passw0rd"
endpoint = "https://my-server-1.myawesomecompany.org"
ssl_insecure = true
},
"my-server-2" = {
user = "admin"
password = "passw0rd"
endpoint = "https://my-server-2.myawesomecompany.org"
ssl_insecure = true
},
}
provider.tf
/*
Copyright (c) 2022-2024 Dell Inc., or its subsidiaries. All Rights Reserved.
Licensed under the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
terraform {
required_providers {
redfish = {
version = "1.3.0"
source = "registry.terraform.io/dell/redfish"
}
}
}
main.tf
/*
Copyright (c) 2023-2024 Dell Inc., or its subsidiaries. All Rights Reserved.
Licensed under the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://mozilla.org/MPL/2.0/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
data "redfish_storage" "storage" {
for_each = var.rack1
redfish_server {
user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
ssl_insecure = each.value.ssl_insecure
}
}
output "storage_volume" {
value = data.redfish_storage.storage
sensitive = true
}
After the successful execution of the above data block, we can see the output in the state file.
Schema
Optional
controller_ids
(List of String) List of IDs of the storage controllers to be fetched.controller_names
(List of String) List of names of the storage controller to be fetched.redfish_server
(Block List) List of server BMCs and their respective user credentials (see below for nested schema)
Read-Only
id
(String) ID of the storage data-sourcestorage
(Attributes List) List of storage controllers fetched. (see below for nested schema)
Nested Schema for redfish_server
Required:
endpoint
(String) Server BMC IP address or hostname
Optional:
password
(String, Sensitive) User password for loginssl_insecure
(Boolean) This field indicates whether the SSL/TLS certificate must be verified or notuser
(String) User name for login
Nested Schema for storage
Read-Only:
description
(String) description of the storagedrive_ids
(List of String) IDs of drives on the storagedrives
(List of String) Names of drives on the storage. They are in same order as indrive_ids
, ie.drives[i]
will be the name of the drive whose ID is given bydrive_ids[i].
name
(String) name of the storageoem
(Attributes) oem attributes of storage controller (see below for nested schema)status
(Attributes) status of the storage (see below for nested schema)storage_controller_id
(String) storage controller idstorage_controllers
(Attributes List) storage controllers list (see below for nested schema)
Nested Schema for storage.oem
Read-Only:
dell
(Attributes) dell attributes (see below for nested schema)
Nested Schema for storage.oem.dell
Read-Only:
dell_controller
(Attributes) dell controller (see below for nested schema)dell_controller_battery
(Attributes) dell controller battery (see below for nested schema)
Nested Schema for storage.oem.dell.dell_controller_battery
Read-Only:
alarm_state
(String) alarm stateauto_config_behavior
(String) auto config behaviorboot_virtual_disk_fqdd
(String) boot virtual disk fqddcache_size_in_mb
(Number) cache size in mbcachecade_capability
(String) cachecade capabilityconnector_count
(Number) connector countcontroller_description
(String) description of the controllercontroller_firmware_version
(String) controller firmware versioncontroller_id
(String) id of controllercontroller_name
(String) controller namecurrent_controller_mode
(String) current controller modedevice
(String) devicedevice_card_data_bus_width
(String) device card data bus widthdevice_card_slot_length
(String) device card slot lengthdevice_card_slot_type
(String) device card slot typedriver_version
(String) driver versionencryption_capability
(String) encryption capabilityencryption_mode
(String) encryption modekey_id
(String) key idlast_system_inventory_time
(String) last system inventory timelast_update_time
(String) last update timemax_available_pci_link_speed
(String) max available pci link speedmax_possible_pci_link_speed
(String) max possible pci link speedpatrol_read_state
(String) patrol read statepci_slot
(String) pci slotpersistent_hotspare
(String) persistent hotsparerealtime_capability
(String) realtime capabilityrollup_status
(String) rollup statussas_address
(String) sas addresssecurity_status
(String) security statusshared_slot_assignment_allowed
(String) shared slot assignment allowedsliced_vd_capability
(String) sliced vd capabilitysupport_controller_boot_mode
(String) support controller boot modesupport_enhanced_auto_foreign_import
(String) support enhanced auto foreign importsupport_raid_10_uneven_spans
(String) support raid 10 uneven spanssupports_lk_mto_sekm_transition
(String) supports lk mto sekm transitiont_10_pi_capability
(String) t 10 pi capability
Nested Schema for storage.oem.dell.dell_controller_battery
Read-Only:
controller_battery_description
(String) description of the controller batterycontroller_battery_id
(String) id of controller batterycontroller_battery_name
(String) controller battery namefqdd
(String) fqddprimary_status
(String) primary_statusraid_state
(String) raid state
Nested Schema for storage.status
Read-Only:
health
(String) healthhealth_rollup
(String) health rollupstate
(String) state of the storage controller
Nested Schema for storage.storage_controllers
Read-Only:
cache_summary
(Attributes) cache summary (see below for nested schema)firmware_version
(String) firmware versionmanufacturer
(String) manufacturermember_id
(String) member id of storage controllermodel
(String) modelname
(String) name of the storage controllerspeed_gbps
(Number) speed gbpsstatus
(Attributes) status of the storage controller (see below for nested schema)supported_controller_protocols
(List of String) supported controller protocolssupported_device_protocols
(List of String) supported device protocolssupported_raid_types
(List of String) supported raid types
Nested Schema for storage.storage_controllers.cache_summary
Read-Only:
total_cache_size_mi_b
(Number)
Nested Schema for storage.storage_controllers.status
Read-Only:
health
(String) healthhealth_rollup
(String) health rollupstate
(String) state of the storage controller