powerflex_device (Resource)
This resource is used to manage the Device entity of PowerFlex Array. We can Create, Update and Delete the PowerFlex Devices using this resource. We can also import an existing device from PowerFlex array.
Caution: Device creation or update is not atomic. In case of partially completed create operations, terraform can mark the resource as tainted. One can manually remove the taint and try applying the configuration (after making necessary adjustments). If the taint is not removed, terraform will destroy and recreate the resource.
Note: Either
storage_pool_name
orstorage_pool_id
is required. But not both.
Note: Either
sds_name
orsds_id
is required. But not both.
Note: If
storage_pool_name
is mentioned, we must specify eitherprotection_domain_id
orprotection_domain_name
but not both.
Example Usage
/*
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.
*/
# Command to run this tf file : terraform init && terraform plan && terraform apply.
# Example for adding device. After successful execution, device will be added to the specified storage pool
resource "powerflex_device" "test-device" {
device_path = "/dev/sdc"
storage_pool_name = "pool1"
protection_domain_name = "domain1"
sds_name = "SDS_2"
media_type = "HDD" # HDD/SSD
}
After the execution of above resource block, device would have been created on the PowerFlex array. For more information, please check the terraform state file.
Schema
Required
device_path
(String) The current path of the device. Cannot be updated.
Optional
device_capacity
(Number) Capacity of the device in GB.external_acceleration_type
(String) External acceleration type of the device. Valid values areNone
,Read
,Write
,ReadAndWrite
.media_type
(String) Media type of the device. Valid values areHDD
,SSD
.name
(String) The name of the device.protection_domain_id
(String) ID of the protection domain. Conflicts withprotection_domain_name
. Cannot be updated.protection_domain_name
(String) Name of the protection domain. Conflicts withprotection_domain_id
. Cannot be updated.sds_id
(String) ID of the SDS. Conflicts withsds_name
. Cannot be updated.sds_name
(String) Name of the SDS. Conflicts withsds_id
. Cannot be updated.storage_pool_id
(String) ID of the storage pool. Conflicts withstorage_pool_name
. Cannot be updated.storage_pool_name
(String) Name of the storage pool. Conflicts withstorage_pool_id
. Cannot be updated.
Read-Only
device_capacity_in_kb
(Number) Capacity of the device in KB.device_original_path
(String) Original path of the device.device_state
(String) State of the device.id
(String) The ID of the device.
Import
Import is supported using the following syntax:
# /*
# 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.
# */
# import Protection Device by it's id
terraform import powerflex_device.device_data "<id>"
- This will import the device instance with specified ID into your Terraform state.
- After successful import, you can run terraform state list to ensure the resource has been imported successfully.
- Now, you can fill in the resource block with the appropriate arguments and settings that match the imported resource’s real-world configuration.
- Execute terraform plan to see if your configuration and the imported resource are in sync. Make adjustments if needed.
- Finally, execute terraform apply to bring the resource fully under Terraform’s management.
- Now, the resource which was not part of terraform became part of Terraform managed infrastructure.