Oracle Cloud Infrastructure 2021 Multicloud Architect Associate — Question 32
You are working with Terraform on your laptop and have been tasked with spinning up multiple compute instances in Oracle Cloud Infrastructure (OCI) for a project. In addition, you are also required to collect IP addresses of provisioned instances and write them to a file and save it in your laptop.
Which specific Terraform functionality can help accomplish this task? (Choose the best answer.)
Answer options
- A. Terraform modules
- B. Terraform remote state
- C. Terraform local-exec
- D. Terraform remote-exec
Correct answer: D
Explanation
The correct answer is D, Terraform remote-exec, as it can execute commands on the remote instances after they are provisioned, allowing you to collect IP addresses and perform file operations. Options A and B are not relevant to executing commands on remote resources, while option C, Terraform local-exec, runs commands on the local machine, which wouldn't help in collecting remote instance IPs.