github.com/kanishk98/terraform@v1.3.0-dev.0.20220917174235-661ca8088a6a/internal/terraform/diagnostics.go (about) 1 package terraform 2 3 import ( 4 "github.com/hashicorp/terraform/internal/tfdiags" 5 ) 6 7 // This file contains some package-local helpers for working with diagnostics. 8 // For the main diagnostics API, see the separate "tfdiags" package. 9 10 // diagnosticCausedByUnknown is an implementation of 11 // tfdiags.DiagnosticExtraBecauseUnknown which we can use in the "Extra" field 12 // of a diagnostic to indicate that the problem was caused by unknown values 13 // being involved in an expression evaluation. 14 // 15 // When using this, set the Extra to diagnosticCausedByUnknown(true) and also 16 // populate the EvalContext and Expression fields of the diagnostic so that 17 // the diagnostic renderer can use all of that information together to assist 18 // the user in understanding what was unknown. 19 type diagnosticCausedByUnknown bool 20 21 var _ tfdiags.DiagnosticExtraBecauseUnknown = diagnosticCausedByUnknown(true) 22 23 func (e diagnosticCausedByUnknown) DiagnosticCausedByUnknown() bool { 24 return bool(e) 25 } 26 27 // diagnosticCausedBySensitive is an implementation of 28 // tfdiags.DiagnosticExtraBecauseSensitive which we can use in the "Extra" field 29 // of a diagnostic to indicate that the problem was caused by sensitive values 30 // being involved in an expression evaluation. 31 // 32 // When using this, set the Extra to diagnosticCausedBySensitive(true) and also 33 // populate the EvalContext and Expression fields of the diagnostic so that 34 // the diagnostic renderer can use all of that information together to assist 35 // the user in understanding what was sensitive. 36 type diagnosticCausedBySensitive bool 37 38 var _ tfdiags.DiagnosticExtraBecauseSensitive = diagnosticCausedBySensitive(true) 39 40 func (e diagnosticCausedBySensitive) DiagnosticCausedBySensitive() bool { 41 return bool(e) 42 }