terraform/command/format
Martin Atkins 275a44f552 command: Reinstate object ids in the UIHook progress logs
We used to treat the "id" attribute of a resource as special and elevate
it into its own struct field "ID" in the state, but the new state format
and provider protocol treats it just as any other attribute.

However, it's still useful to show the value of a single identifying
attribute when there isn't room in the UI for showing all of the
attributes, and so here we take a new strategy of considering "id" along
with some other conventional names as special only in the UI layer.

This new heuristic approach can be adjusted over time as new provider
patterns emerge, but for now it covers some common conventions we've seen
in real providers.

With that said, since all existing providers made for Terraform versions
prior to v0.12 were forced to set "id", we won't see any use of other
attributes here until providers are updated to remove the placeholder
ids they were generating in cases where an id was not actually relevant
but was forced by the old protocol. At that point the UX should be
improved by showing a more relevant attribute instead.

We now also allow for the possibility of no id at all, since that is valid
for resources that exist only within the Terraform state, like the ones
from the "random" and "tls" providers.
2018-10-16 19:14:11 -07:00
..
diagnostic.go command/format: include source snippets in diagnostics 2018-10-16 18:20:32 -07:00
diff.go command/format: print correctly nested blocks with labels 2018-10-16 19:14:11 -07:00
format.go command/format: a package for formatting plans/state for output 2017-01-26 14:33:49 -08:00
object_id.go command: Reinstate object ids in the UIHook progress logs 2018-10-16 19:14:11 -07:00
object_id_test.go command: Reinstate object ids in the UIHook progress logs 2018-10-16 19:14:11 -07:00
plan.go core: Handle forced-create_before_destroy during the plan walk 2018-10-16 19:14:11 -07:00
state.go command/format: be resilient to incomplete schema when formatting state 2018-10-16 19:14:11 -07:00
state_test.go cli: format/state_test.go 2018-10-16 19:14:11 -07:00