Open radeksimko opened 4 years ago
I think this problem is a different specific symptom of the same general problem described in #15419, though it's interesting to see that Terraform is considering this as a change needing to be applied: that suggests that the situation around #15419 has changed in the meantime, and I wonder therefore if a change to a data resource might now also appear as an empty diff to confirm. :thinking:
I didn't include the removal of data resources in there, but I suppose potentially it could be handled a bit like the data source change in the UI mock I shared over there:
# data.packet_ip_block_ranges.test2 has been removed since last apply
- data "packet_ip_block_ranges" "test2" {
- project_id = "(whatever a packet project id looks like)"
}
I'm not going to merge these two issues for now since the situations do seem a little different, but I'm leaving this comment mainly to create the connection between the two issues.
Removal of resources from config schedules them for removal during the next
apply
and user has to acknowledge that. It is therefore possible to confirm intentions and prevent accidents. Even when the user chooses to ignore plan, theapply
output will notify them of the removal viaRemoval of data sources is practically invisible and always happens behind the scenes.
This can lead to a confusing UX where user is prompted to confirm application of an empty plan:
Example
Before
After
Apply
Also resources seem to have some sort of fallback mechanism where they still get refreshed based on the existing state (without config), unlike data sources.
While we discourage use of
-refresh=false
(for good reasons), this can also happen accidentally when user points Terraform to wrong (empty) directory, which can be more unconscious human mistake. In such case the resources get refreshed, but all data sources are gone from the state.^ that is what happened in my case