0
0
Terraformcloud~10 mins

Terraform state list command - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to list all resources in the Terraform state.

Terraform
terraform state [1]
Drag options to blanks, or click blank then click option'
Ainit
Blist
Capply
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' instead of 'list' to view resources
Using 'apply' which changes infrastructure
Using 'init' which initializes Terraform
2fill in blank
medium

Complete the command to list resources in a specific Terraform workspace.

Terraform
terraform workspace select [1] && terraform state list
Drag options to blanks, or click blank then click option'
Aprod
Bdefault
Cinit
Dplan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'init' or 'plan' as workspace names
Not selecting a workspace before listing state
3fill in blank
hard

Fix the error in the command to list resources with a filter prefix.

Terraform
terraform state list [1]
Drag options to blanks, or click blank then click option'
A-filter=aws_instance
B-state=aws_instance
Caws_instance
D-target=aws_instance
Attempts:
3 left
💡 Hint
Common Mistakes
Using unsupported flags like '-filter' or '-state'
Using '-target' which is for apply, not list
4fill in blank
hard

Fill both blanks to list resources filtered by prefix and output to a file.

Terraform
terraform state list [1] > [2]
Drag options to blanks, or click blank then click option'
Aaws_s3_bucket
Bresources.txt
Cterraform.tfstate
Doutput.log
Attempts:
3 left
💡 Hint
Common Mistakes
Redirecting output to the state file itself
Using wrong resource prefixes
5fill in blank
hard

Fill all three blanks to list resources, filter by prefix, and select a workspace.

Terraform
terraform workspace select [1] && terraform state list [2] > [3]
Drag options to blanks, or click blank then click option'
Adev
Baws_lambda_function
Clambda_resources.txt
Dprod
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing workspace names and file names
Using unsupported flags in the list command