Skip to content

Commit ebccc51

Browse files
committed
GetResourceType function added
1 parent 50a35d0 commit ebccc51

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

external/states/statefile/resources.go

+18
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,21 @@ func GetResourcesArn(f io.Reader) []string {
5959
}
6060
return arns
6161
}
62+
63+
// Returns the list of resource types
64+
func GetResourcesTypes(f io.Reader) []string {
65+
result, err := Read(f)
66+
if err != nil {
67+
panic(err)
68+
}
69+
70+
types := make([]string, 0)
71+
72+
state := result.State
73+
for _, ms := range state.Modules {
74+
for _, re := range ms.Resources {
75+
types = append(types, re.Addr.Resource.Type)
76+
}
77+
}
78+
return types
79+
}

0 commit comments

Comments
 (0)