-
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.
core: Allow data resource count to be unknown during refresh
The count for a data resource can potentially depend on a managed resource that isn't recorded in the state yet, in which case references to it will always return unknown. Ideally we'd do the data refreshes during the plan phase as discussed in #17034, which would avoid this problem by planning the managed resources in the same walk, but for now we'll just skip refreshing any data resources with an unknown count during refresh and defer that work to the apply phase, just as we'd do if there were unknown values in the main configuration for the data resource.
- Loading branch information
1 parent
95e5ef1
commit 3309be9
Showing
4 changed files
with
103 additions
and
33 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
7 changes: 7 additions & 0 deletions
7
terraform/test-fixtures/refresh-data-count/refresh-data-count.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,7 @@ | ||
resource "test" "foo" { | ||
things = ["foo"] | ||
} | ||
|
||
data "test" "foo" { | ||
count = length(test.foo.things) | ||
} |