From f2c3fbe2f0fac8cd41aee7e4aabbead8b848b2c0 Mon Sep 17 00:00:00 2001 From: FloxD Date: Mon, 19 May 2025 23:07:48 +0200 Subject: [PATCH] added example to terraform state list documentation (#35377) --- website/docs/cli/commands/state/list.mdx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/website/docs/cli/commands/state/list.mdx b/website/docs/cli/commands/state/list.mdx index 3da2091d90..b3b429e8e0 100644 --- a/website/docs/cli/commands/state/list.mdx +++ b/website/docs/cli/commands/state/list.mdx @@ -54,6 +54,18 @@ aws_instance.bar[0] aws_instance.bar[1] ``` +## Example: Filtering with an index + +This example will show you how to filter when your filter includes an index: + +``` +$ terraform state list 'foo[0].bar' +foo[0].bar.lorem +foo[0].bar.ipsum +``` + +Use single quotes to prevent your command line from interpreting the square brackets as shell syntax. + ## Example: Filtering by Module This example will list resources in the given module and any submodules: