in types/utils.go [168:240]
func getInputProperties(address string, p *tfjson.Plan) []string {
for _, resourceChange := range p.ResourceChanges {
if resourceChange == nil || resourceChange.Change == nil || resourceChange.Change.Before == nil ||
(resourceChange.Address != address && !strings.HasPrefix(resourceChange.Address, address+"[")) {
continue
}
stateMap, ok := resourceChange.Change.Before.(map[string]interface{})
if !ok {
return nil
}
props := make([]string, 0)
if stateMap["tags"] != nil {
if tags, ok := stateMap["tags"].(map[string]interface{}); ok && len(tags) > 0 {
props = append(props, "tags")
}
}
if stateMap["identity"] != nil {
if identities, ok := stateMap["identity"].([]interface{}); ok && len(identities) > 0 {
if identity, ok := identities[0].(map[string]interface{}); ok {
if identity["type"] != nil {
if identityType, ok := identity["type"].(string); ok && len(identityType) > 0 {
props = append(props, "identity.type")
}
if identityIds, ok := identity["identity_ids"].([]interface{}); ok && len(identityIds) > 0 {
props = append(props, "identity.userAssignedIdentities")
}
}
}
}
}
if stateMap["body"] != nil {
if body, ok := stateMap["body"].(string); ok {
var bodyObj interface{}
if err := json.Unmarshal([]byte(body), &bodyObj); err == nil {
propValueMap := getPropValueMap(bodyObj, "")
propSet := make(map[string]bool)
for key := range propValueMap {
key = strings.TrimPrefix(key, ".")
if strings.HasPrefix(key, "tags") {
key = "tags"
}
propSet[key] = true
}
for key := range propSet {
key = removeIndexOfProp(key)
props = append(props, key)
}
}
} else {
if bodyObj := stateMap["body"]; bodyObj != nil {
propValueMap := getPropValueMap(bodyObj, "")
propSet := make(map[string]bool)
for key := range propValueMap {
key = strings.TrimPrefix(key, ".")
if strings.HasPrefix(key, "tags") {
key = "tags"
}
propSet[key] = true
}
for key := range propSet {
key = removeIndexOfProp(key)
props = append(props, key)
}
}
}
}
return props
}
return nil
}