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

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

Answer: D

Explanation:

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

Latest TA-002-P Dumps Valid Version with 324 Q&As

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

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments