Show resource in state terraform
Display all attributes of a specific resource in state
terraform state show 'aws_instance.web[0]'
more terraform
all 43 commands →
Move resource in state
terraform state mv 'aws_instance.web' 'module.app.aws_instance.web'
Import existing resource
terraform import 'aws_s3_bucket.mybucket' my-existing-bucket
Taint resource for recreation
terraform taint 'aws_instance.web[0]'
Remove resource from state
terraform state rm 'aws_instance.legacy'
Show outputs
terraform output -json | jq 'to_entries[] | {(.key): .value.value}'