Show the details of what resources will be created

This commit is contained in:
Yissachar Radcliffe 2016-09-06 11:45:46 -04:00
parent 4608ef57ef
commit 0c3277476c
1 changed files with 21 additions and 0 deletions

View File

@ -79,6 +79,27 @@ func (t *DryRunTarget) PrintReport(taskMap map[string]Task, out io.Writer) error
for _, r := range creates {
taskName := getTaskName(r.changes)
fmt.Fprintf(b, " %s\t%s\n", taskName, IdForTask(taskMap, r.e))
changes := reflect.ValueOf(r.changes)
if changes.Kind() == reflect.Ptr && !changes.IsNil() {
changes = changes.Elem()
}
if changes.Kind() == reflect.Struct {
for i := 0; i < changes.NumField(); i++ {
field := changes.Field(i)
fieldName := changes.Type().Field(i).Name
fieldValue := ValueAsString(field)
// The field name is already printed above, no need to repeat it.
// Additionally, ignore any output that is not informative
if fieldName != "Name" && fieldValue != "<nil>" && fieldValue != "id:<nil>" && fieldValue != "<resource>" {
fmt.Fprintf(b, " \t%s\t%s\n", fieldName, fieldValue)
}
}
}
}
}