-
Notifications
You must be signed in to change notification settings - Fork 241
all: Add automatic deferred action support for unknown provider configuration #1335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
efdc771
update plugin-go
austinvalle d9c6993
quick implementation of automatic deferral (no opt-in currently)
austinvalle b7c02ce
add opt-in logic with ResourceBehavior
austinvalle f44c9fe
update naming on exported structs/fields
austinvalle 1f768dc
add data source tests
austinvalle 07e816a
add readresource tests
austinvalle 39bf469
refactor planresourcechange tests
austinvalle d16367c
remove configure from tests
austinvalle 90c72f9
add new PlanResourceChange RPC tests
austinvalle 0cac590
update import logic + add tests for ImportResourceState
austinvalle c8c3e47
Merge branch 'main' into av/dfa
austinvalle fe1ea31
update sdkv2 to match new protocol changes + pass deferral allowed to…
austinvalle bf74443
update terraform-plugin-go
austinvalle 4dcc2ad
update plugin-go
austinvalle e3e7e45
name changes + doc updates + remove duplicate diags
austinvalle be070c1
add logging
austinvalle eb08273
error message update
austinvalle 9450487
pkg doc updates
austinvalle 3ad892a
add changelogs
austinvalle 8251ffc
add copywrite header
austinvalle 276a421
go mod tidy :)
austinvalle 11c5a6d
Merge branch 'main' into av/dfa
austinvalle 30c6157
Merge branch 'main' into av/dfa
austinvalle aed628d
replace TODO comment on import
austinvalle 0598563
replace if check for deferralAllowed
austinvalle bd21c5e
replace logging key with a constant
austinvalle c31bc00
use the proper error returning method for test assertions
austinvalle 207c950
add experimental verbiage
austinvalle 470473d
DeferredResponse -> Deferred
austinvalle e216dec
Merge branch 'main' into av/dfa
austinvalle ec6e0a2
Merge branch 'main' into av/dfa
austinvalle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: FEATURES | ||
body: 'helper/schema: Added `(Provider).ConfigureProvider` function for configuring | ||
providers that support additional features, such as deferred actions.' | ||
time: 2024-05-06T15:20:18.393505-04:00 | ||
custom: | ||
Issue: "1335" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: FEATURES | ||
body: 'helper/schema: Added `(Resource).ResourceBehavior` to allow additional control | ||
over deferred action behavior during plan modification.' | ||
time: 2024-05-06T15:21:35.304825-04:00 | ||
custom: | ||
Issue: "1335" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: NOTES | ||
body: This release contains support for deferred actions, which is an experimental | ||
feature only available in prerelease builds of Terraform 1.9 and later. This functionality | ||
is subject to change and is not protected by version compatibility guarantees. | ||
time: 2024-05-09T13:49:45.38523-04:00 | ||
custom: | ||
Issue: "1335" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package schema | ||
|
||
// MAINTAINER NOTE: Only PROVIDER_CONFIG_UNKNOWN (enum value 2 in the plugin-protocol) is relevant | ||
// for SDKv2. Since (Deferred).Reason is mapped directly to the plugin-protocol, | ||
// the other enum values are intentionally omitted here. | ||
const ( | ||
// DeferredReasonUnknown is used to indicate an invalid `DeferredReason`. | ||
// Provider developers should not use it. | ||
DeferredReasonUnknown DeferredReason = 0 | ||
|
||
// DeferredReasonProviderConfigUnknown represents a deferred reason caused | ||
// by unknown provider configuration. | ||
DeferredReasonProviderConfigUnknown DeferredReason = 2 | ||
) | ||
|
||
// Deferred is used to indicate to Terraform that a resource or data source is not able | ||
// to be applied yet and should be skipped (deferred). After completing an apply that has deferred actions, | ||
// the practitioner can then execute additional plan and apply “rounds” to eventually reach convergence | ||
// where there are no remaining deferred actions. | ||
// | ||
// NOTE: This functionality is related to deferred action support, which is currently experimental and is subject | ||
// to change or break without warning. It is not protected by version compatibility guarantees. | ||
type Deferred struct { | ||
// Reason represents the deferred reason. | ||
Reason DeferredReason | ||
} | ||
|
||
// DeferredReason represents different reasons for deferring a change. | ||
// | ||
// NOTE: This functionality is related to deferred action support, which is currently experimental and is subject | ||
// to change or break without warning. It is not protected by version compatibility guarantees. | ||
type DeferredReason int32 | ||
|
||
func (d DeferredReason) String() string { | ||
switch d { | ||
case 0: | ||
return "Unknown" | ||
case 2: | ||
return "Provider Config Unknown" | ||
} | ||
return "Unknown" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.