Resource: aws_neptune_global_cluster

Manages a Neptune Global Cluster. A global cluster consists of one primary region and up to five read-only secondary regions. You issue write operations directly to the primary cluster in the primary region and Amazon Neptune automatically replicates the data to the secondary regions using dedicated infrastructure.

More information about Neptune Global Clusters can be found in the Neptune User Guide.

Example Usage

New Neptune Global Cluster

provider "aws" {
  alias  = "primary"
  region = "us-east-2"
}

provider "aws" {
  alias  = "secondary"
  region = "us-east-1"
}

resource "aws_neptune_global_cluster" "example" {
  global_cluster_identifier = "global-test"
  engine                    = "neptune"
  engine_version            = "1.2.0.0"
}

resource "aws_neptune_cluster" "primary" {
  provider                  = aws.primary
  engine                    = aws_neptune_global_cluster.example.engine
  engine_version            = aws_neptune_global_cluster.example.engine_version
  cluster_identifier        = "test-primary-cluster"
  global_cluster_identifier = aws_neptune_global_cluster.example.id
  neptune_subnet_group_name = "default"
}

resource "aws_neptune_cluster_instance" "primary" {
  provider                  = aws.primary
  engine                    = aws_neptune_global_cluster.example.engine
  engine_version            = aws_neptune_global_cluster.example.engine_version
  identifier                = "test-primary-cluster-instance"
  cluster_identifier        = aws_neptune_cluster.primary.id
  instance_class            = "db.r5.large"
  neptune_subnet_group_name = "default"
}

resource "aws_neptune_cluster" "secondary" {
  provider                  = aws.secondary
  engine                    = aws_neptune_global_cluster.example.engine
  engine_version            = aws_neptune_global_cluster.example.engine_version
  cluster_identifier        = "test-secondary-cluster"
  global_cluster_identifier = aws_neptune_global_cluster.example.id
  neptune_subnet_group_name = "default"
}

resource "aws_neptune_cluster_instance" "secondary" {
  provider                  = aws.secondary
  engine                    = aws_neptune_global_cluster.example.engine
  engine_version            = aws_neptune_global_cluster.example.engine_version
  identifier                = "test-secondary-cluster-instance"
  cluster_identifier        = aws_neptune_cluster.secondary.id
  instance_class            = "db.r5.large"
  neptune_subnet_group_name = "default"

  depends_on = [
    aws_neptune_cluster_instance.primary
  ]
}

New Global Cluster From Existing DB Cluster

resource "aws_neptune_cluster" "example" {
  # ... other configuration ...

  # NOTE: Using this DB Cluster to create a Global Cluster, the
  # global_cluster_identifier attribute will become populated and
  # Terraform will begin showing it as a difference. Do not configure:
  # global_cluster_identifier = aws_neptune_global_cluster.example.id
  # as it creates a circular reference. Use ignore_changes instead.
  lifecycle {
    ignore_changes = [global_cluster_identifier]
  }
}

resource "aws_neptune_global_cluster" "example" {
  global_cluster_identifier    = "example"
  source_db_cluster_identifier = aws_neptune_cluster.example.arn
}

Argument Reference

This resource supports the following arguments:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_neptune_global_cluster using the Global Cluster identifier. For example:

import {
  to = aws_neptune_global_cluster.example
  id = "example"
}

Using terraform import, import aws_neptune_global_cluster using the Global Cluster identifier. For example:

% terraform import aws_neptune_global_cluster.example example

Certain resource arguments, like source_db_cluster_identifier, do not have an API method for reading the information after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use ignore_changes to hide the difference. For example:

resource "aws_neptune_global_cluster" "example" {
  # ... other configuration ...

  # There is no API for reading source_db_cluster_identifier
  lifecycle {
    ignore_changes = [source_db_cluster_identifier]
  }
}