This function finds all blocks of a specific type under a single resource or block in the state of the current workspace using the tfstate/v2 import.
This function is contained in the tfstate-functions.sentinel module.
find_blocks = func(parent, child)
- parent: a single resource or block of a resource
- child: a string representing the child blocks to be found in the parent.
None
This function returns a single list of child blocks found in the parent resource or block. Each child block is represented by a map.
This function does not print anything.
Here are some examples of calling this function, assuming that the tfstate-functions.sentinel file that contains it has been imported with the alias state
:
ingressRules = state.find_blocks(sg, "ingress")
disks = state.find_blocks(vm, "disk")