From 404cd1feeb84c68c53ed0ae57737dfc62a8b287d Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 28 Mar 2018 16:08:26 -0400 Subject: [PATCH] resource/aws_rds_cluster_instance: Prevent crash on importing non-cluster instances --- aws/resource_aws_rds_cluster_instance.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws/resource_aws_rds_cluster_instance.go b/aws/resource_aws_rds_cluster_instance.go index 3402f25613a..be55cf66054 100644 --- a/aws/resource_aws_rds_cluster_instance.go +++ b/aws/resource_aws_rds_cluster_instance.go @@ -307,6 +307,10 @@ func resourceAwsRDSClusterInstanceRead(d *schema.ResourceData, meta interface{}) d.SetId("") return nil } + // Database instance is not in RDS Cluster + if db.DBClusterIdentifier == nil { + return fmt.Errorf("Cluster identifier is missing from instance (%s). The aws_db_instance resource should be used for non-Aurora instances", d.Id()) + } // Retrieve DB Cluster information, to determine if this Instance is a writer conn := meta.(*AWSClient).rdsconn