Deploying a PowerFlex SDC using a CSV Topology File

This guide explains how to use a CSV file as input for an SDC Resource.


Note: In the CSV file, provide only Cluster Node-related details as shown in the example below:


IPs,Password,Operating System,Is MDM/TB,Is SDC,perfProfileForSDC,SDC Name,password,linux,Primary,Yes,HighPerformance,SDC1,password,linux,Secondary,Yes,HighPerformance,SDC2,password,linux,TB,Yes,Compact,SDC3,password,linux,Standby,Yes,Compact,SDC4

To perform SDC operations via CSV file(s), use the following configuration:

locals {
  csv_data = csvdecode(file("data/sdc_input.csv"))

resource "powerflex_sdc" "sdc_rs" {
  mdm_password = "MDM_Password"
  lia_password = "LIA_Password"

  sdc_details = [
    for row in local.csv_data : {
      ip                  = row.IPs # if using complere config use row["MDM IPs"]
      password            = row.Password
      operating_system    = row["Operating System"]
      is_mdm_or_tb        = row["Is MDM/TB"]
      is_sdc              = row["Is SDC"]
      name                = row["SDC Name"]
      performance_profile = row.perfProfileForSDC
    if row.IPs != "" && row.IPs != "null" && row.Password != "null"

This code demonstrates how you can use data from the CSV file to dynamically configure the powerflex_sdc resource.

locals: This section defines local variables within the Terraform configuration. These variables are used to store data or perform calculations within your configuration.

csv_data: This is a local variable that is being assigned the result of csvdecode(file(“sdc_input.csv”)). It decodes the content of the “sdc_input.csv” file into a data structure that can be used in the Terraform configuration.

file("sdc_input.csv"): This part of the code specifies the path to the CSV file. In this example, it assumes that “sdc_input.csv” is located in the same directory as your Terraform configuration file. If the CSV file is in a different directory, you can provide the relative or absolute path to that file. For example, if the CSV file is in a subdirectory named “data,” you can specify the path as file(“data/sdc_input.csv”).

sdc_details: This is an attribute of the powerflex_sdc resource. You are using a list comprehension (the for loop) to create a list of objects based on the data from the CSV file (local.csv_data). Each object represents a configuration for an SDC (Storage Data Client).

The fields inside the object (e.g., ip, password, operating_system, etc.) are populated with values from the CSV file. You are also applying some conditions in the if statement to filter out rows where IPs and Password are not empty and not equal to “null.”