-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
See func (d *ResourceData) State() *terraform.InstanceState { for a good example.
The core of this function is:
rawMap := make(map[string]interface{})
for k := range d.schema {
source := getSourceSet
if d.partial {
source = getSourceState
if _, ok := d.partialMap[k]; ok {
source = getSourceSet
}
}
raw := d.get([]string{k}, source)
if raw.Exists && !raw.Computed {
rawMap[k] = raw.Value
if raw.ValueProcessed != nil {
rawMap[k] = raw.ValueProcessed
}
}
}
Within this, the call to d.get(...) which uses a combination of the Schema and InstanceState to build a nested and correctly typed representation of the resource.
Next steps are:
-
Work out how a ResourceData is constructed and initialized with the correct set of FieldWriters (MapFieldWriter, MergeFieldWriter etc)
-
Confirm that the representation that is returned works for lists and lists of nested resources
-
Write a class to convert from this representation to a Resource for printing
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels