Skip to content

Commit

Permalink
Avoid drift detection when using manual mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Luiz Filho committed Oct 30, 2023
1 parent 7c9d9d7 commit 3ce8ebb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha2/terraform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,10 @@ func (in *TerraformSpec) GetAlwaysCleanupRunnerPod() bool {
return *in.AlwaysCleanupRunnerPod
}

func (in TerraformSpec) IsManualMode() bool {
return in.ApprovePlan == "" || (in.ApprovePlan != ApprovePlanDisableValue && in.ApprovePlan != ApprovePlanAutoValue)
}

func (c *CloudSpec) IsValid() bool {
if c.Organization == "" {
return false
Expand Down
5 changes: 5 additions & 0 deletions controllers/tf_controller_drift_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func (r *TerraformReconciler) shouldDetectDrift(terraform infrav1.Terraform, rev
return false
}

// whenever we are in manual mode, we do not do drift detection
if terraform.Spec.IsManualMode() {
return false
}

// new object
if terraform.Status.LastAppliedRevision == "" &&
terraform.Status.LastPlannedRevision == "" &&
Expand Down

0 comments on commit 3ce8ebb

Please sign in to comment.