Complete the code to import an AWS S3 bucket state using Terraform CLI.
terraform import [1] my-bucket
The correct resource address for importing the S3 bucket state is aws_s3_bucket.example.
Complete the Terraform command to verify the imported state of a resource.
terraform state [1] aws_s3_bucket.examplelist which shows all resources, not details of one.rm which deletes the resource from state.The terraform state show command displays the attributes of the imported resource.
Fix the error in the Terraform import command to correctly import an AWS EC2 instance with ID i-1234567890abcdef0.
terraform import aws_instance.web [1]
The import command requires the actual resource ID, which is i-1234567890abcdef0 for the EC2 instance.
Fill both blanks to correctly remove a resource from Terraform state and then verify the state list.
terraform state [1] aws_s3_bucket.example terraform state [2]
show instead of list to see all resources.mv which moves resources instead of removing.First, terraform state rm removes the resource from state. Then, terraform state list shows the current resources in state.
Fill both blanks to correctly move a resource in Terraform state and then show its details.
terraform state [1] aws_instance.old_name aws_instance.new_name terraform state [2] aws_instance.new_name
rm instead of mv to move resources.list instead of show to see resource details.The terraform state mv command moves a resource from one address to another. Then, terraform state show displays the resource details.