powerflex_resource_credential (Resource)

This resource is used to manage Resource Credential entity of the PowerFlex Array. This feature is only supported for PowerFlex 4.5 and above. We can Create, Update and Delete the PowerFlex Resource Credentials using this resource. We can also Import an existing Resource Credentials from the PowerFlex array.

Example Usage

/*
Copyright (c) 2025 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 {
    powerflex = {
      source  = "registry.terraform.io/dell/powerflex"
    }
    local = {
      source = "hashicorp/local"
      version = "2.5.2"
    }
    vault = {
      source = "hashicorp/vault"
      version = "4.6.0"
    }
  }
}
// Used to grab the password
provider "vault" {
 address = "https://my-vault-server.com"
 token = "some-token-value"
}

provider "powerflex" {
  username =  "user"
  password = "password"
  endpoint = "https://example.com"
  insecure = true
  timeout  = 120
}

// Can grab secret from vault
# data "vault_generic_secret" "secret"{
#  path = "secret/instances"
# }

# Command to run this tf file : terraform init && terraform plan && terraform apply
# Create, Read, Delete and Import operations are supported for this resource

## Optional only needed if using ssh_private_key field
# data "local_file" "ssh_key" {
#   filename = var.ssh_private_key_path
# }

# Create Resource Credential
resource "powerflex_resource_credential" "example" {
 ## Required values for all credential types
 name = var.name
 type = var.type // Options: Node, Switch, vCenter, ElementManager, PowerflexGateway, PresentationServer, OSAdmin, OSUser
 username = var.username
 // Grab from variable file
 password = var.password
 ## Grab from vault 
 #password = "${data.vault_generic_secret.secret.data["password"]}"

 ## Required value for vCenter, ElementManager, OSUser
 #domain = var.domain

 ## Required value for PowerflexGateway
 #os_username = var.os_username
 #os_password = var.os_password

 ## Optional values for Node, Switch, ElementManager
 #snmp_v2_community_string = var.snmpv2_community_string

 ## Optional for Node
 #snmp_v3_security_level = var.snmpv3_security_level // Options "Minimal", "Moderate", or "Maximal"
 #snmp_v3_security_name = var.snmpv3_security_name
 #snmp_v3_md5_authentication_password = var.snmpv3_md5_auth_password // required for level "Moderate" and "Maximal"
 #snmp_v3_des_authentication_password = var.snmpv3_des_private_password // required for level "Maximal"

 ## Optional for Node, Switch, OSAdmin, OSUser
 #ssh_private_key = data.local_file.ssh_key.content
 #key_pair_name = var.key_pair_name
}

After the execution of above resource block, resource would have been created on the PowerFlex array. For more information, please check the terraform state file.

Schema

Required

  • name (String) Resource Credential name
  • password (String, Sensitive) Resource Credential password
  • type (String) Resource Credential type
  • username (String) Resource Credential username

Optional

  • domain (String) Resource Credential domain, used by types OSUser, ElementManager and vCenterCredential
  • key_pair_name (String) Resource Credential key_pair_name, can be used by types Node, Switch, OSAdminCrednetial and OSUserCredential. Is Required if ssh_private_key is set
  • os_password (String, Sensitive) Resource Credential os_password, used by types PowerflexGateway
  • os_username (String) Resource Credential os_username, used by types PowerflexGateway
  • snmp_v2_community_string (String) Resource Credential snmp_v2_community_string, used by types Node, Switch and ElementManager. If unset it will default to public
  • snmp_v3_des_authentication_password (String, Sensitive) Resource Credential snmp_v3_des_authentication_password, used by types Node when snmp_v3_security_level is set to Maximal
  • snmp_v3_md5_authentication_password (String, Sensitive) Resource Credential snmp_v3_md5_authentication_password, used by types Node when snmp_v3_security_level is set to Moderate
  • snmp_v3_security_level (String) Resource Credential snmp_v3_security_level, used by types Node. Minimal requires only snmp_v3_security_name, Moderate requires snmp_v3_security_name and snmp_v3_md5_authentication_password, Maximal requires snmp_v3_security_name, snmp_v3_md5_authentication_password and snmp_v3_des_authentication_password
  • snmp_v3_security_name (String) Resource Credential snmp_v3_security_name, used by types Node
  • ssh_private_key (String, Sensitive) Resource Credential ssh_private_key, can be used by types Node, Switch, OSAdminCrednetial and OSUserCredential

Read-Only

  • created_by (String) Resource Credential created_by
  • created_date (String) Resource Credential created_date
  • id (String) Unique identifier of the resource credential instance.
  • updated_by (String) Resource Credential updated_by
  • updated_date (String) Resource Credential updated_date

Import

Import is supported using the following syntax:

# /*
# Copyright (c) 2025 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 resource credential by its id
terraform import powerflex_resource_credential.example "<id>"
  1. This will import the resource instance with specified ID into your Terraform state.
  2. After successful import, you can run terraform state list to ensure the resource has been imported successfully.
  3. Now, you can fill in the resource block with the appropriate arguments and settings that match the imported resource’s real-world configuration.
  4. Execute terraform plan to see if your configuration and the imported resource are in sync. Make adjustments if needed.
  5. Finally, execute terraform apply to bring the resource fully under Terraform’s management.
  6. Now, the resource which was not part of terraform became part of Terraform managed infrastructure.