powerflex_replication_consistency_group (Resource)

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

Example Usage

/*
Copyright (c) 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 {
    powerflex = {
      source                = "registry.terraform.io/dell/powerflex"
      configuration_aliases = [powerflex.source, powerflex.destination]
    }
  }
}

provider "powerflex" {
  alias    = "source"
  username = var.username_source
  password = var.password_source
  endpoint = var.endpoint_source
  insecure = true
  timeout  = 120
}

provider "powerflex" {
  alias    = "destination"
  username = var.username_destination
  password = var.password_destination
  endpoint = var.endpoint_destination
  insecure = true
  timeout  = 120
}

data "powerflex_protection_domain" "source_protection_domain" {
  provider = powerflex.source
  name     = var.source_protection_domain_name
}

data "powerflex_protection_domain" "destination_protection_domain" {
  provider = powerflex.destination
  name     = var.destination_protection_domain_name
}

resource "powerflex_replication_consistency_group" "example" {
  provider = powerflex.source
  ### Required Values

  # New name of the Replication Consistency Group
  name = var.name
  # Protection domain on the source machine
  protection_domain_id = data.powerflex_protection_domain.source_protection_domain.protection_domains[0].id
  # Protection domain on the destination machine
  remote_protection_domain_id = data.powerflex_protection_domain.destination_protection_domain.protection_domains[0].id
  # Destination System ID
  destination_system_id = data.powerflex_protection_domain.destination_protection_domain.protection_domains[0].system_id

  ### Optional with defaults if unset

  # Must be greater the 15 or less then 3600 (seconds) Default: 15
  #rpo_in_seconds = 15
  # Sets the Active state, Options (Active, Terminated) Default: Active
  #local_activity_state = "Active"
  # Sets the Volume Access Mode, Options (NoAccess, ReadOnly) Default: NoAccess
  #target_volume_access_mode = "NoAccess"
  # Pause Mode, Options (Resume, Pause) Default: Resume
  #pause_mode = "Resume"
  # Freeze State, Options (Unfrozen, Frozen) Default: Unfrozen
  #freeze_state = "Unfrozen"
  # Current Consistency Mode, Options (Consistent, Inconsistent) Default: Consistent
  #curr_consist_mode = "Consistent"
}

After the execution of above resource block, the Replication Consistency Group will be created between the two Peer Systems. The user can then add Replication Pairs to the RCGs in order to replicate volumes between systems. For more information, please check the terraform state file.

Schema

Required

  • destination_system_id (String) Replication Consistency Group Destination System ID
  • name (String) Replication Consistency Group Name
  • protection_domain_id (String) Replication Consistency Group Protection Domain ID
  • remote_protection_domain_id (String) Replication Consistency Group Remote Protection Domain ID

Optional

  • curr_consist_mode (String) Consistency Mode of the replication consistency group instance.
  • freeze_state (String) Freeze State of the replication consistency group instance.
  • local_activity_state (String) Local Activity State of the replication consistency group instance.
  • pause_mode (String) Pause Mode of the replication consistency group instance.
  • rpo_in_seconds (Number) Replication Consistency Group RPO in Seconds (min: 15, default 15, max: 3600)
  • target_volume_access_mode (String) Target Volume Access Mode of the replication consistency group instance.

Read-Only

  • abstract_state (String) Abstract State of the replication consistency group instance.
  • active_local (Boolean) Active Local of the replication consistency group instance.
  • active_remote (Boolean) Active Remote of the replication consistency group instance.
  • disaster_recovery_state (String) Disaster Recovery State of the replication consistency group instance.
  • error (Number) Error of the replication consistency group instance.
  • failover_state (String) Failover State of the replication consistency group instance.
  • failover_type (String) Failover Type of the replication consistency group instance.
  • id (String) Unique identifier of the replication consistency group instance.
  • inactive_reason (Number) Inactive Reason of the replication consistency group instance.
  • last_snap_group_id (String) Last Snap Group ID of the replication consistency group instance.
  • lifetime_state (String) Lifetime State of the replication consistency group instance.
  • peer_mdm_id (String) Replication Consistency Group Peer Mdm ID
  • remote_activity_state (String) Remote Activity State of the replication consistency group instance.
  • remote_disaster_recovery_state (String) Remote Disaster Recovery State of the replication consistency group instance.
  • remote_id (String) Remote ID of the replication consistency group instance.
  • remote_mdm_id (String) Remote MDM ID of the replication consistency group instance.
  • replication_direction (String) Replication Direction of the replication consistency group instance.
  • snap_creation_in_progress (Boolean) Snap Creation In Progress of the replication consistency group instance.
  • type (String) Type of the replication consistency group instance.

Import

Import is supported using the following syntax:

# /*
# Copyright (c) 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 Replication Consistency Group by its id
terraform import powerflex_replication_consistency_group.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.