@@ -206,17 +206,17 @@ const (
206
206
TerraformFinalizer = "finalizers.tf.contrib.fluxcd.io"
207
207
MaxConditionMessageLength = 20000
208
208
DisabledValue = "disabled"
209
- HealthyCondition = "Healthy"
210
209
211
210
// ArtifactFailedReason represents the fact that the
212
211
// source artifact download failed.
213
212
ArtifactFailedReason = "ArtifactFailed"
214
213
215
- TFExecInstallFailedReason = "TFExecInstallFailed"
216
- TFExecNewFailedReason = "TFExecNewFailed"
217
- TFExecInitFailedReason = "TFExecInitFailed"
218
- TFExecPlanFailedReason = "TFExecPlanFailed"
219
- TFExecApplyFailedReason = "TFExecApplyFailed"
214
+ TFExecNewFailedReason = "TFExecNewFailed"
215
+ TFExecInitFailedReason = "TFExecInitFailed"
216
+ TFExecPlanFailedReason = "TFExecPlanFailed"
217
+ TFExecApplyFailedReason = "TFExecApplyFailed"
218
+ TFExecOutputFailedReason = "TFExecOutputFailed"
219
+ OutputsWritingFailedReason = "OutputsWritingFailed"
220
220
)
221
221
222
222
// SetKustomizationReadiness sets the ReadyCondition, ObservedGeneration, and LastAttemptedRevision, on the Kustomization.
@@ -240,17 +240,25 @@ func SetTerraformReadiness(terraform *Terraform, status metav1.ConditionStatus,
240
240
terraform .Status .LastAttemptedRevision = revision
241
241
}
242
242
243
- func TerraformApplying (terraform Terraform , message string ) Terraform {
243
+ func TerraformApplying (terraform Terraform , revision string , message string ) Terraform {
244
244
meta .SetResourceCondition (& terraform , "Apply" , metav1 .ConditionUnknown , meta .ProgressingReason , message )
245
+ if revision != "" {
246
+ (& terraform ).Status .LastAppliedRevision = revision
247
+ }
245
248
return terraform
246
249
}
247
250
248
- func TerraformOutputAvailable (terraform Terraform , availableOutputs []string , message string ) Terraform {
249
- meta .SetResourceCondition (& terraform , "Output" , metav1 .ConditionTrue , "TerraformOutputAvailable " , message )
251
+ func TerraformOutputsAvailable (terraform Terraform , availableOutputs []string , message string ) Terraform {
252
+ meta .SetResourceCondition (& terraform , "Output" , metav1 .ConditionTrue , "TerraformOutputsAvailable " , message )
250
253
(& terraform ).Status .AvailableOutputs = availableOutputs
251
254
return terraform
252
255
}
253
256
257
+ func TerraformOutputsWritten (terraform Terraform , message string ) Terraform {
258
+ meta .SetResourceCondition (& terraform , "Output" , metav1 .ConditionTrue , "TerraformOutputsWritten" , message )
259
+ return terraform
260
+ }
261
+
254
262
func TerraformApplied (terraform Terraform , revision string , message string ) Terraform {
255
263
meta .SetResourceCondition (& terraform , "Apply" , metav1 .ConditionTrue , "TerraformAppliedSucceed" , message )
256
264
plan := terraform .Status .Plan .Pending
@@ -266,26 +274,30 @@ func TerraformApplied(terraform Terraform, revision string, message string) Terr
266
274
267
275
func TerraformPlannedWithChanges (terraform Terraform , revision string , message string ) Terraform {
268
276
planRev := strings .Replace (revision , "/" , "-" , 1 )
269
- meta .SetResourceCondition (& terraform , "Plan" , metav1 .ConditionTrue , "TerraformPlannedSucceed " , message )
277
+ meta .SetResourceCondition (& terraform , "Plan" , metav1 .ConditionTrue , "TerraformPlannedWithChanges " , message )
270
278
(& terraform ).Status .Plan = PlanStatus {
271
279
LastApplied : terraform .Status .Plan .LastApplied ,
272
280
Pending : fmt .Sprintf ("plan-%s" , planRev ),
273
281
}
274
282
if revision != "" {
275
283
(& terraform ).Status .LastAttemptedRevision = revision
276
284
}
285
+
286
+ SetTerraformReadiness (& terraform , metav1 .ConditionUnknown , "TerraformPlannedWithChanges" , message , revision )
277
287
return terraform
278
288
}
279
289
280
290
func TerraformPlannedNoChanges (terraform Terraform , revision string , message string ) Terraform {
281
- meta .SetResourceCondition (& terraform , "Plan" , metav1 .ConditionFalse , "TerraformPlannedSucceed " , message )
291
+ meta .SetResourceCondition (& terraform , "Plan" , metav1 .ConditionFalse , "TerraformPlannedNoChanges " , message )
282
292
(& terraform ).Status .Plan = PlanStatus {
283
293
LastApplied : terraform .Status .Plan .LastApplied ,
284
294
Pending : "" ,
285
295
}
286
296
if revision != "" {
287
297
(& terraform ).Status .LastAttemptedRevision = revision
288
298
}
299
+
300
+ SetTerraformReadiness (& terraform , metav1 .ConditionTrue , "TerraformPlannedNoChanges" , message , revision )
289
301
return terraform
290
302
}
291
303
0 commit comments