func NewPassReportFromState()

in tf/utils.go [114:136]


func NewPassReportFromState(state *tfjson.State) types.PassReport {
	out := types.PassReport{
		Resources: make([]types.Resource, 0),
	}
	if state == nil || state.Values == nil || state.Values.RootModule == nil || state.Values.RootModule.Resources == nil {
		logrus.Warnf("new pass report from state: state is nil")
		return out
	}
	for _, res := range state.Values.RootModule.Resources {
		if !strings.HasPrefix(res.Address, "azapi_") {
			continue
		}
		resourceType := ""
		if v, ok := res.AttributeValues["type"]; ok {
			resourceType = v.(string)
		}
		out.Resources = append(out.Resources, types.Resource{
			Type:    resourceType,
			Address: res.Address,
		})
	}
	return out
}