hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

[Enhancement]: resource/aws_neptune_cluster_instance: Missing options for snapshots #29172

Open gdavison opened 1 year ago

gdavison commented 1 year ago

Description

The resource aws_neptune_cluster_instance does not currently support options for controlling snapshots, including:

Affected Resource(s) and/or Data Source(s)

aws_neptune_cluster_instance

Potential Terraform Configuration

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

triggan commented 1 year ago

Snapshots on Neptune are controlled at the Neptune Cluster level. No data is persisted on Neptune instances, as all instances in the cluster use a shared cluster volume for storage. Is there a reason why you need the listed settings for snapshots for an instance?

gdavison commented 1 year ago

The AWS API allows taking a snapshot when deleting an instance. We support this for most other AWS managed data stores, so for consistency, we should support it for the aws_neptune_cluster_instance resource.

triggan commented 1 year ago

I can see where you are coming from, but there's a bit more to the story. Neptune's control plane is based on that of the RDS control plane and the underlying CLI/SDK options are based on the same options that you would see for RDS. In some cases, these options do not apply, due to differences in the data plane/engine architecture for Neptune vs RDS or Aurora.

If you try to specify a final snapshot when deleting a read replica in a Neptune cluster (for example):

aws neptune delete-db-instance --db-instance-identifier neptune-instance-replica-xlarge-2 \
    --region us-west-2 \
    --debug --no-skip-final-snapshot \
    --final-db-snapshot-identifier testinstsnap

You'll get an error, such as the following:

An error occurred (InvalidParameterCombination) when calling the DeleteDBInstance operation:
 FinalDBSnapshotIdentifier can not be specified when deleting a cluster instance

The man page for the aws neptune delete-db-instance also states:

       --skip-final-snapshot | --no-skip-final-snapshot (boolean)
          Determines whether a final DB snapshot is created before the DB
          instance is deleted. If true is specified, no DBSnapshot is created.
          If false is specified, a DB snapshot is created before the DB
          instance is deleted.

          Note that when a DB instance is in a failure state and has a status
          of 'failed', 'incompatible-restore', or 'incompatible-network', it
          can only be deleted when the SkipFinalSnapshot parameter is set to
          "true".

          **Specify true when deleting a Read Replica.**

... which is different than the man page description for the same option for RDS.

Even if you specify --no-skip-final-snapshot, the option gets ignored.

These options only apply when deleting the cluster.