Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 246 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 246
Topic #: 1
[All Terraform Associate Questions]

When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?

  • A. Before you run terraform import
  • B. You can import infrastructure without corresponding Terraform code
  • C. Terraform will generate the corresponding configuration files for you
  • D. After you run terraform import
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Ni33
Highly Voted 1 year, 6 months ago
Selected Answer: A
A is the correct answer !
upvoted 13 times
...
blop213
Most Recent 6 months, 3 weeks ago
If D is right then B is necesarry right, and since its not multiple choice, it can only be A Right answer : A
upvoted 1 times
...
Tricejer
9 months, 3 weeks ago
Selected Answer: A
A is correct
upvoted 1 times
...
Blitz123
9 months, 3 weeks ago
as per terraform 1.0 which is the latest version for exam its B. You can import infrastructure without corresponding Terraform code
upvoted 2 times
...
uax
1 year ago
Selected Answer: A
When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform? A. Before you run terraform import.
upvoted 1 times
...
AdriBFK
1 year, 2 months ago
Selected Answer: A
Tested
upvoted 1 times
...
arunrkaushik
1 year, 3 months ago
You cannot import the resource unless the resource's basic block is not coded in the .tf file. Hence this is the 1st step. Once a basic block is written, you import the resources and enhance the code using the state details. <b> Before you run terraform import </b>
upvoted 2 times
...
seifskl
1 year, 4 months ago
Selected Answer: A
Please refer to this link https://developer.hashicorp.com/terraform/cli/import/usage It is said: "To import a resource, first write a resource block for it in your configuration, establishing the name by which it will be known to Terraform ... Now terraform import can be run to attach an existing instance to this resource configuration"
upvoted 4 times
...
lukacs16
1 year, 4 months ago
Selected Answer: A
"To import a resource, first write a resource block for it in your configuration, establishing the name by which it will be known to Terraform" Answer is A. https://developer.hashicorp.com/terraform/cli/import/usage
upvoted 2 times
...
Foram31
1 year, 5 months ago
Selected Answer: D
1. Run terraform import to bring the existing resources under Terraform management. This command allows you to import the existing resources into the Terraform state without the corresponding Terraform configuration files. 2.After importing the resources, you should write the Terraform configuration files to define and manage the imported resources. These configuration files specify the desired state of the infrastructure and allow you to make changes to it in a controlled manner.
upvoted 2 times
...
yubac
1 year, 5 months ago
Selected Answer: A
Condidering and existing infrastructurre on a cloud provider, in order to manage these resources on terraform you need: 1. foreach resource, add at least the resources definition using resource_type.resource_name {} 2. foreach resource, use terraform import resource_type.resource_name <id>
upvoted 1 times
...
Sydurrahman12
1 year, 6 months ago
which one right A or D?
upvoted 1 times
...
sdm13168
1 year, 6 months ago
Selected Answer: A
https://spacelift.io/blog/importing-exisiting-infrastructure-into-terraform
upvoted 2 times
...
Sathisgm
1 year, 6 months ago
Answer is D
upvoted 2 times
...
MarshalLaw
1 year, 6 months ago
Selected Answer: D
D: You can use the import command to migrate existing resources into your Terraform state file. The import command does not currently generate the configuration for the imported resource, so you must write the corresponding configuration block to map the imported resource to it. Importing infrastructure involves five steps: 1 Identify the existing infrastructure you will import. 2 Import infrastructure into your Terraform state file. 3 Write Terraform configuration that matches that infrastructure. 4 Review the Terraform plan to ensure the configuration matches the expected state and infrastructure. 5 Apply the configuration to update your Terraform state. Source: https://developer.hashicorp.com/terraform/tutorials/state/state-import
upvoted 4 times
[Removed]
1 year, 4 months ago
Answer is A. Source: https://developer.hashicorp.com/terraform/tutorials/state/state-import. Has been updated with new steps for Terraform v1.5 Using configuration to import resources involves the following steps: Identify the existing infrastructure you will import. Define an import block for the resources. Run terraform plan to review the import plan and optionally generate configuration for the resources. Prune generated configuration to only the required arguments. Apply the configuration to bring the resource into your Terraform state file.
upvoted 1 times
joyboy23
1 year, 4 months ago
But that is your "Import config", It is not the "existing infra config"
upvoted 1 times
...
...
...
dbrosowskiCW
1 year, 6 months ago
A: You need to have the corresponding resources defined in your Terraform configuration files before you can import them.
upvoted 3 times
...
Oleg_gol
1 year, 6 months ago
Selected Answer: D
D. After you run terraform import
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...