The instance id of ...
 
Notifications
Clear all

The instance id of that EC2 instance is i-0260835eb7e9bd40 How he can import data of EC2 to state file?

1 Posts
1 Users
0 Likes
285 Views
(@mcgruenathaniel)
Noble Member
Joined: 2 years ago
Posts: 732
Topic starter  

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?

  • A . terraform import aws_instance.id = i-0260835eb7e9bd40
  • B . terraform import i-0260835eb7e9bd40
  • C . terraform import aws_instance.i-0260835eb7e9bd40
  • D . terraform import aws_instance.matt_ec2 i-0260835eb7e9bd40

Show Answer Hide Answer

Suggested Answer: D

Explanation:

https://www.terraform.io/docs/import/usage.html

   
Quote

Latest HashiCorp TA-002-P Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: