exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 20 discussion

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

You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with
Terraform and want to manage these VMs using Terraform instead.
What are the two things you must do to achieve this? (Choose two.)

  • A. Provision new VMs using Terraform with the same VM names
  • B. Use the terraform import command for the existing VMs
  • C. Write Terraform configuration for the existing VMs
  • D. Run the terraform import-gcp command
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
tipzzz
Highly Voted 2 years, 8 months ago
BC for sure
upvoted 33 times
...
fabiomlop
Highly Voted 2 years, 6 months ago
Selected Answer: BC
You should create the equivalent configuration first, and then run import to load it on the state file.
upvoted 17 times
prabdarq
1 month ago
@fabiomlop... Is it so or either one of the process is sufficient? Kindly clarify
upvoted 1 times
...
...
SilentMilli
Most Recent 3 months ago
Selected Answer: BC
To manage the VMs that were provisioned using the gcloud command line tool using Terraform, you must first use the "terraform import" command to import the existing VMs into Terraform's state file. This allows Terraform to recognize the VMs and manage them as part of your infrastructure. After importing the VMs, you must then write Terraform configuration for the existing VMs. This includes defining the resources for the VMs and specifying the necessary configuration options, such as the instance type and image, as well as any other desired settings. By doing this, you can manage the VMs using Terraform, which provides a single, unified tool for provisioning, configuring, and managing your infrastructure.
upvoted 1 times
...
doodlearmy
5 months, 3 weeks ago
Selected Answer: BC
there is no 'import-gcp' in terraform official doc
upvoted 1 times
...
kingfighers
9 months ago
there is no 'import-gcp' in terraform official doc
upvoted 2 times
...
enook
12 months ago
Selected Answer: BC
BCBCBCBCBCBC
upvoted 2 times
...
Tyler2023
1 year, 2 months ago
There are two ways to manage existing resource using Terraform You can use 'terraform import' or you can use the import block So answers are: B. Use the terraform import command for the existing VMs Most Voted C. Write Terraform configuration for the existing VMs https://developer.hashicorp.com/terraform/cli/import/usage https://developer.hashicorp.com/terraform/language/import
upvoted 3 times
...
Jayanth
1 year, 5 months ago
B. Use the terraform import command for the existing VMs C. Write Terraform configuration for the existing VMs
upvoted 2 times
...
Busi57
1 year, 5 months ago
Selected Answer: BC
i choose BC
upvoted 1 times
...
Busi57
1 year, 5 months ago
i choose BC
upvoted 2 times
...
Shane_C
1 year, 5 months ago
Selected Answer: BC
BC are the correct answers here
upvoted 1 times
...
milan92stankovic
1 year, 6 months ago
Selected Answer: BC
Write configuration and import.
upvoted 1 times
...
Ni33
1 year, 7 months ago
Selected Answer: BC
B&C are correct
upvoted 2 times
...
karendavtyan
1 year, 7 months ago
Selected Answer: BC
B.True C. True
upvoted 1 times
...
AzRNoob
1 year, 8 months ago
BC are the correct options: B. Use the terraform import command for the existing VMs. This command allows you to import existing infrastructure into your Terraform state file so that Terraform can manage it. You will need to provide the resource type and name, along with any required attributes, for each VM you want to import. C. Write Terraform configuration for the existing VMs. Once the VMs have been imported into the Terraform state file, you will need to write configuration code that describes the desired state of the VMs. This will typically involve creating a new Terraform module or modifying an existing one to include the imported resources. Option A is incorrect because provisioning new VMs with the same names would create duplicate resources and could cause conflicts with the existing VMs. Option D is also incorrect because there is no terraform import-gcp command in Terraform. The correct command for importing GCP resources is simply terraform import.
upvoted 10 times
...
connecttozee
1 year, 9 months ago
BC is correct https://developer.hashicorp.com/terraform/tutorials/state/state-import
upvoted 1 times
...
Power123
1 year, 9 months ago
B,C - first write the configuration and then import
upvoted 1 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago