-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stackeval: Basic support for deferred-change propagation
This is the bare minimum functionality to ensure that we defer all actions in any component that depends on a component that already had deferred actions. We will also eventually need to propagate out a signal to the caller for whether the stack plan as a whole is complete or incomplete, but we'll save that for later commits, since the stack orchestration in Terraform Cloud will do the right thing regardless, aside from the cosmetic concern that it won't yet know to show a message to the user saying that there are deferred changes.
- Loading branch information
1 parent
2dab42b
commit 268c6fb
Showing
5 changed files
with
244 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
32 changes: 32 additions & 0 deletions
32
...stdata/sourcebundle/planning/deferred_changes_propagation/deferred-changes-propagation.tf
This file contains 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,32 @@ | ||
|
||
terraform { | ||
required_providers { | ||
test = { | ||
source = "terraform.io/builtin/test" | ||
} | ||
} | ||
|
||
# TODO: Remove this if this experiment gets stabilized. | ||
# If you're removing this, remember to also update the calling test so | ||
# that it no longer enables the use of experiments, to ensure that we're | ||
# really not depending on any experimental features. | ||
experiments = [unknown_instances] | ||
} | ||
|
||
variable "instance_count" { | ||
type = number | ||
} | ||
|
||
resource "test" "a" { | ||
# This one has on intrinsic need to be deferred, but | ||
# should still be deferred when an upstream component | ||
# has a deferral. | ||
} | ||
|
||
resource "test" "b" { | ||
count = var.instance_count | ||
} | ||
|
||
output "constant_one" { | ||
value = 1 | ||
} |
35 changes: 35 additions & 0 deletions
35
...urcebundle/planning/deferred_changes_propagation/deferred-changes-propagation.tfstack.hcl
This file contains 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,35 @@ | ||
|
||
required_providers { | ||
test = { | ||
source = "terraform.io/builtin/test" | ||
} | ||
} | ||
|
||
provider "test" "main" { | ||
} | ||
|
||
variable "first_count" { | ||
type = number | ||
} | ||
|
||
component "first" { | ||
source = "./" | ||
|
||
inputs = { | ||
instance_count = var.first_count | ||
} | ||
providers = { | ||
test = provider.test.main | ||
} | ||
} | ||
|
||
component "second" { | ||
source = "./" | ||
|
||
inputs = { | ||
instance_count = component.first.constant_one | ||
} | ||
providers = { | ||
test = provider.test.main | ||
} | ||
} |