Skip to content

Latest commit

 

History

History
172 lines (142 loc) · 7.58 KB

replication_pair.md

File metadata and controls

172 lines (142 loc) · 7.58 KB
title linkTitle page_title subcategory description
powerflex_replication_pair resource
powerflex_replication_pair
powerflex_replication_pair Resource - powerflex
This resource is used to manage the Replication Pairs 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 Pairs using this resource. We can also Import an existing Replication Pairs from the PowerFlex array. A replication pair involves a set of data on a source system being continuously copied to a target system. This typically applies to individual volumes, files, or objects.

powerflex_replication_pair (Resource)

This resource is used to manage the Replication Pairs 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 Pairs using this resource. We can also Import an existing Replication Pairs from the PowerFlex array. A replication pair involves a set of data on a source system being continuously copied to a target system. This typically applies to individual volumes, files, or objects.

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
}

# Used to get the id of the source volume
data "powerflex_volume" "source_volume" {
  provider = powerflex.source
  name     = var.volume_name_source
}

# Used to get the id of the destination volume
data "powerflex_volume" "destination_volume" {
  provider = powerflex.destination
  name     = var.volume_name_destination
}

# Used to get the id of the replication consistency group
data "powerflex_replication_consistency_group" "source_replication_consistency_group" {
  provider = powerflex.source
  filter {
    name = [var.replication_consistency_group_name_source]
  }
}

# Commands to run this tf file : terraform init && terraform plan && terraform apply
# Create, Update, Delete is supported for this resource
# name, source_volume_id, destination_volume_id, replication_consistency_group_id are the required parameters to create or update
# Only pause_initial_copy can be updated to true or false

# Create Replication Pair
resource "powerflex_replication_pair" "example" {
  provider = powerflex.source
  # Required values
  name                             = "example-replication-pair"
  source_volume_id                 = data.powerflex_volume.source_volume.volumes[0].id
  destination_volume_id            = data.powerflex_volume.destination_volume.volumes[0].id
  replication_consistency_group_id = data.powerflex_replication_consistency_group.source_replication_consistency_group.replication_consistency_group_details[0].id
  # Optional values
  # pause_initial_copy = true # Pauses the replication pair (This will only work during the initial copy process), defaults to false
}

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

  • destination_volume_id (String) Destination Volume ID
  • name (String) Replication Pair Name
  • replication_consistency_group_id (String) Replication Consistency Group ID
  • source_volume_id (String) Source Volume ID

Optional

  • pause_initial_copy (Boolean) Pause Copy of the replication pair instance.

Read-Only

  • copy_type (String) Copy Type for Replication Pairs only value is OnlineCopy
  • id (String) Unique identifier of the replication pair instance.
  • initial_copy_priority (Number) Initial Copy Priority of the replication pair instance.
  • initial_copy_state (String) Initial Copy State of the replication pair instance.
  • lifetime_state (String) Lifetime State of the replication pair instance.
  • local_volume_id (String) Local Volume ID of the replication pair instance.
  • peer_system_name (String) Peer System Name of the replication pair instance.
  • remote_capacity_in_mb (Number) Remote Capacity in MB of the replication pair instance.
  • remote_id (String) Remote ID of the replication pair instance.
  • remote_volume_id (String) Remote Volume ID of the replication pair instance.
  • remote_volume_name (String) Remote Volume Name of the replication pair instance.
  • user_requested_pause_transmit_init_copy (Boolean) User Requested Pause of the replication pair 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 Pair by its id
terraform import powerflex_replication_pair.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.