Skip to content

Commit

Permalink
ISSUE-376: Removing the condition that looks for outputs in tfstate t…
Browse files Browse the repository at this point in the history
…o decide if tfstate is generated or not (#377)

Co-authored-by: Gaurav Jaswal <[email protected]>
  • Loading branch information
jaswalkiranavtar and Gaurav Jaswal authored Sep 1, 2023
1 parent 1dfb4a3 commit 4e21b54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions controllers/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1145,16 +1145,8 @@ func (meta *TFConfigurationMeta) isTFStateGenerated(ctx context.Context) bool {
return false
}
// 2. and exist tfstate file
tfStateJSON, err := meta.Backend.GetTFStateJSON(ctx)
if err != nil {
return false
}
// 3. and outputs not empty
var tfState TFState
if err = json.Unmarshal(tfStateJSON, &tfState); err != nil {
return false
}
return len(tfState.Outputs) > 0
_, err := meta.Backend.GetTFStateJSON(ctx)
return err == nil
}

//nolint:funlen
Expand Down
2 changes: 1 addition & 1 deletion controllers/configuration_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ func TestIsTFStateGenerated(t *testing.T) {
meta: meta3,
},
want: want{
generated: false,
generated: true,
},
},
"outputs in the backend secret are not empty": {
Expand Down

0 comments on commit 4e21b54

Please sign in to comment.