provider/aws: Fix the import of `aws_redshift_cluster` breaking (#7677)
`skip_final_snapshot` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSRedshiftCluster_importBasic' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSRedshiftCluster_importBasic -timeout 120m === RUN TestAccAWSRedshiftCluster_importBasic --- PASS: TestAccAWSRedshiftCluster_importBasic (641.87s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 641.888s ```
This commit is contained in:
parent
4ab654a6f6
commit
7879450cf3
|
@ -21,7 +21,7 @@ func resourceAwsRedshiftCluster() *schema.Resource {
|
||||||
Update: resourceAwsRedshiftClusterUpdate,
|
Update: resourceAwsRedshiftClusterUpdate,
|
||||||
Delete: resourceAwsRedshiftClusterDelete,
|
Delete: resourceAwsRedshiftClusterDelete,
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
State: schema.ImportStatePassthrough,
|
State: resourceAwsRedshiftClusterImport,
|
||||||
},
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
|
@ -212,6 +212,15 @@ func resourceAwsRedshiftCluster() *schema.Resource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resourceAwsRedshiftClusterImport(
|
||||||
|
d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||||
|
// Neither skip_final_snapshot nor final_snapshot_identifier can be fetched
|
||||||
|
// from any API call, so we need to default skip_final_snapshot to true so
|
||||||
|
// that final_snapshot_identifier is not required
|
||||||
|
d.Set("skip_final_snapshot", true)
|
||||||
|
return []*schema.ResourceData{d}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func resourceAwsRedshiftClusterCreate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsRedshiftClusterCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
conn := meta.(*AWSClient).redshiftconn
|
conn := meta.(*AWSClient).redshiftconn
|
||||||
|
|
||||||
|
@ -557,11 +566,8 @@ func resourceAwsRedshiftClusterDelete(d *schema.ResourceData, meta interface{})
|
||||||
ClusterIdentifier: aws.String(d.Id()),
|
ClusterIdentifier: aws.String(d.Id()),
|
||||||
}
|
}
|
||||||
|
|
||||||
skipFinalSnapshot, exists := d.GetOk("skip_final_snapshot")
|
skipFinalSnapshot := d.Get("skip_final_snapshot").(bool)
|
||||||
if !exists {
|
deleteOpts.SkipFinalClusterSnapshot = aws.Bool(skipFinalSnapshot)
|
||||||
skipFinalSnapshot = true
|
|
||||||
}
|
|
||||||
deleteOpts.SkipFinalClusterSnapshot = aws.Bool(skipFinalSnapshot.(bool))
|
|
||||||
|
|
||||||
if skipFinalSnapshot == false {
|
if skipFinalSnapshot == false {
|
||||||
if name, present := d.GetOk("final_snapshot_identifier"); present {
|
if name, present := d.GetOk("final_snapshot_identifier"); present {
|
||||||
|
|
Loading…
Reference in New Issue