Skip to content

Commit

Permalink
fix a possible panic with autopilot import (#1801)
Browse files Browse the repository at this point in the history
fix a panic with autopilot import
  • Loading branch information
fairclothjm authored Mar 17, 2023
1 parent 3cb0f4f commit 9089df7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vault/resource_raft_autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func readAutopilotConfigResource(d *schema.ResourceData, meta interface{}) error
if err != nil {
return fmt.Errorf("error reading %q: %s", autopilotPath, err)
}
if resp == nil {
log.Printf("[WARN] Autopilot configuration %q not found, removing it from state", autopilotPath)
d.SetId("")
return nil
}

if val, ok := resp.Data["cleanup_dead_servers"]; ok {
if err := d.Set("cleanup_dead_servers", val); err != nil {
Expand Down

0 comments on commit 9089df7

Please sign in to comment.