nerdexam
HashiCorpHashiCorp

TA-002-P · Question #156

TA-002-P Question #156: Real Exam Question with Answer & Explanation

Sign in or unlock TA-002-P to reveal the answer and full explanation for question #156. The question stem and answer options stay visible for context.

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

Matt wants to import a manually created EC2 instance into terraform so that he can manage the EC2 instance through terraform going forward. He has written the configuration file of the EC2 instance before importing it to Terraform. Following is the code: resource "aws_instance" "matt_ec2" { ami = "ami-bg2640de" instance_type = "t2.micro" vpc_security_group_ids = ["sg-6ae7d613", "sg-53370035"] key_name = "mysecret" subnet_id = "subnet-9e3cfbc5" } The instance id of that EC2 instance is i-0260835eb7e9bd40 How he can import data of EC2 to state file?

Options

  • Aterraform import aws_instance.id = i-0260835eb7e9bd40
  • Bterraform import i-0260835eb7e9bd40
  • Cterraform import aws_instance.i-0260835eb7e9bd40
  • Dterraform import aws_instance.matt_ec2 i-0260835eb7e9bd40

Unlock TA-002-P to see the answer

You've previewed enough free TA-002-P questions. Unlock TA-002-P for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#Terraform import#Terraform CLI#State management#AWS EC2
Full TA-002-P PracticeBrowse All TA-002-P Questions