|
| 1 | +// Copyright (c) HashiCorp, Inc. |
| 2 | +// SPDX-License-Identifier: MPL-2.0 |
| 3 | + |
| 4 | +package ephemeral |
| 5 | + |
| 6 | +const ( |
| 7 | + // DeferredReasonUnknown is used to indicate an invalid `DeferredReason`. |
| 8 | + // Provider developers should not use it. |
| 9 | + DeferredReasonUnknown DeferredReason = 0 |
| 10 | + |
| 11 | + // DeferredReasonEphemeralResourceConfigUnknown is used to indicate that the resource configuration |
| 12 | + // is partially unknown and the real values need to be known before the change can be planned. |
| 13 | + DeferredReasonEphemeralResourceConfigUnknown DeferredReason = 1 |
| 14 | + |
| 15 | + // DeferredReasonProviderConfigUnknown is used to indicate that the provider configuration |
| 16 | + // is partially unknown and the real values need to be known before the change can be planned. |
| 17 | + DeferredReasonProviderConfigUnknown DeferredReason = 2 |
| 18 | + |
| 19 | + // DeferredReasonAbsentPrereq is used to indicate that a hard dependency has not been satisfied. |
| 20 | + DeferredReasonAbsentPrereq DeferredReason = 3 |
| 21 | +) |
| 22 | + |
| 23 | +// Deferred is used to indicate to Terraform that a change needs to be deferred for a reason. |
| 24 | +// |
| 25 | +// NOTE: This functionality is related to deferred action support, which is currently experimental and is subject |
| 26 | +// to change or break without warning. It is not protected by version compatibility guarantees. |
| 27 | +type Deferred struct { |
| 28 | + // Reason is the reason for deferring the change. |
| 29 | + Reason DeferredReason |
| 30 | +} |
| 31 | + |
| 32 | +// DeferredReason represents different reasons for deferring a change. |
| 33 | +// |
| 34 | +// NOTE: This functionality is related to deferred action support, which is currently experimental and is subject |
| 35 | +// to change or break without warning. It is not protected by version compatibility guarantees. |
| 36 | +type DeferredReason int32 |
| 37 | + |
| 38 | +func (d DeferredReason) String() string { |
| 39 | + switch d { |
| 40 | + case 0: |
| 41 | + return "Unknown" |
| 42 | + case 1: |
| 43 | + return "Ephemeral Resource Config Unknown" |
| 44 | + case 2: |
| 45 | + return "Provider Config Unknown" |
| 46 | + case 3: |
| 47 | + return "Absent Prerequisite" |
| 48 | + } |
| 49 | + return "Unknown" |
| 50 | +} |
0 commit comments