google_netapp_volume_replication

Volume replication creates an asynchronous mirror of a volume in a different location. This capability lets you use the replicated volume for critical application activity in case of a location-wide outage or disaster.

A new destination volume is created as part of the replication resource. It's content is updated on a schedule with content of the source volume. It can be used as a read-only copy while the mirror is enabled, or as an independent read-write volume while the mirror is stopped. A destination volume will also contain the snapshots of the source volume. Resuming a mirror will overwrite all changes on the destination volume with the content of the source volume. While is mirror is enabled, all configuration changes done to source or destination volumes are automatically done to both. Please note that the destination volume is not a resource managed by Terraform.

Reversing the replication direction is not supported through the provider.

To get more information about VolumeReplication, see:

Open in Cloud Shell

Example Usage - Netapp Volume Replication Create

data "google_compute_network" "default" {
  name = "test-network"
}

resource "google_netapp_storage_pool" "source_pool" {
  name          = "source-pool"
  location      = "us-central1"
  service_level = "PREMIUM"
  capacity_gib  = 2048
  network       = data.google_compute_network.default.id
}

resource "google_netapp_storage_pool" "destination_pool" {
  name          = "destination-pool"
  location      = "us-west2"
  service_level = "PREMIUM"
  capacity_gib  = 2048
  network       = data.google_compute_network.default.id
}

resource "google_netapp_volume" "source_volume" {
  location     = google_netapp_storage_pool.source_pool.location
  name         = "source-volume"
  capacity_gib = 100
  share_name   = "source-volume"
  storage_pool = google_netapp_storage_pool.source_pool.name
  protocols = [
    "NFSV3"
  ]
  deletion_policy = "FORCE"
}

resource "google_netapp_volume_replication" "test_replication" {
  depends_on           = [google_netapp_volume.source_volume]
  location             = google_netapp_volume.source_volume.location
  volume_name          = google_netapp_volume.source_volume.name
  name                 = "test-replication"
  replication_schedule = "EVERY_10_MINUTES"
  description          = "This is a replication resource"
  destination_volume_parameters {
    storage_pool = google_netapp_storage_pool.destination_pool.id
    volume_id    = "destination-volume"
    # Keeping the share_name of source and destination the same
    # simplifies implementing client failover concepts
    share_name  = "source-volume"
    description = "This is a replicated volume"
  }
  # WARNING: Setting delete_destination_volume to true, will delete the
  # CURRENT destination volume if the replication is deleted. Omit the field 
  # or set delete_destination_volume=false to avoid accidental volume deletion.
  delete_destination_volume = true
  wait_for_mirror = true
}

Argument Reference

The following arguments are supported:


The destination_volume_parameters block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

The transfer_stats block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

VolumeReplication can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import VolumeReplication using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}"
  to = google_netapp_volume_replication.default
}

When using the terraform import command, VolumeReplication can be imported using one of the formats above. For example:

$ terraform import google_netapp_volume_replication.default projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/replications/{{name}}
$ terraform import google_netapp_volume_replication.default {{project}}/{{location}}/{{volume_name}}/{{name}}
$ terraform import google_netapp_volume_replication.default {{location}}/{{volume_name}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.