Skip to content

Commit

Permalink
Swap MigrateState to one requested by reviewer.
Browse files Browse the repository at this point in the history
  • Loading branch information
akatrevorjay committed Jun 11, 2019
1 parent 122b8d5 commit dbc10a0
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions aws/resource_aws_elasticache_replication_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,13 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource {
},
},
SchemaVersion: 1,
MigrateState: resourceAwsElasticacheReplicationGroupMigrateState,

// SchemaVersion: 1 did not include any state changes via MigrateState.
// Perform a no-operation state upgrade for Terraform 0.12 compatibility.
// Future state migrations should be performed with StateUpgraders.
MigrateState: func(v int, inst *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
return inst, nil
},

Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(60 * time.Minute),
Expand All @@ -235,22 +241,6 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource {
}
}

func resourceAwsElasticacheReplicationGroupMigrateState(v int, inst *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) {
switch v {
case 0:
log.Printf("[WARN] Elasticache Replication Group (%s) v%d; migrating to v1 (noop)", inst, v)

fallthrough

case 1:
// Current version
return inst, nil

default:
return inst, fmt.Errorf("Unexpected schema version: %d", v)
}
}

func resourceAwsElasticacheReplicationGroupCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).elasticacheconn

Expand Down

0 comments on commit dbc10a0

Please sign in to comment.