exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 10 discussion

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

You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code.
What is the best method to quickly find the IP address of the resource you deployed?

  • A. Run terraform output ip_address to view the result
  • B. In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
  • C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
  • D. Run terraform destroy then terraform apply and look for the IP address in stdout
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
coco10k
Highly Voted 2 years, 8 months ago
Selected Answer: C
You can find the info in the state. not A because you don't have to outputs defined.
upvoted 31 times
...
fasaleAkshay
Most Recent 3 months ago
Selected Answer: C
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including the public IP address.
upvoted 2 times
...
Serg853377
3 months ago
Answer C
upvoted 1 times
...
SilentMilli
3 months ago
Selected Answer: C
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address. This option allows you to easily find the public IP address of the resource you deployed, without having to destroy and recreate it. The terraform state list command lists all of the resources that have been added to the state, while the terraform state show command displays the attributes of a specific resource, including its public IP address.
upvoted 1 times
...
nharaz
3 months ago
Selected Answer: C
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address If you have not created any outputs in your Terraform code, you can still find the public IP address of the resource by using the terraform state commands. First, you can run terraform state list to see a list of all the resources that Terraform is managing in the state file. Look for the resource with a type that matches your webapp, such as "aws_instance" or "google_compute_instance". Once you have found the name of the resource, you can run terraform state show <resource_name> to view all of the attributes of the resource, including the public IP address. For example, if the name of the resource is "webapp", you would run terraform state show webapp. This will display all of the attributes of the resource, including the public IP address.
upvoted 2 times
...
camps
3 months ago
Selected Answer: C
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address is the best method to quickly find the IP address of the resource you deployed. terraform state list will show you the name of all the resources currently tracked in your Terraform state. You can then use terraform state show followed by the resource name to see all the details of the resource, including any attributes like the public IP address.
upvoted 2 times
...
samimshaikh
3 months ago
Selected Answer: C
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes, including the public IP address. Explanation: Not Option A (terraform output ip_address) assumes that there is an output variable named ip_address in your Terraform configuration, but since you mentioned that you did not create any outputs, this option may not be applicable.
upvoted 2 times
...
hrajkuma
5 months, 2 weeks ago
vote for option C
upvoted 1 times
...
brundabanm
6 months, 2 weeks ago
C is the correct answer.
upvoted 1 times
...
Prat8
1 year, 1 month ago
Is it C or A ?
upvoted 1 times
...
luke404
1 year, 1 month ago
Selected Answer: C
The question does not talk about any output defined so you can't expect one
upvoted 1 times
...
gofavad926
1 year, 3 months ago
Selected Answer: C
C for sure
upvoted 1 times
...
otakuinside
1 year, 3 months ago
Selected Answer: C
A cannot be. You don't have any output declared, so there is no default output or something like that where you could find the ip address. On the other hand, terraform state list, and then show specific, contains the state and this includes the ip address
upvoted 2 times
...
grogudev
1 year, 3 months ago
Selected Answer: C
C I choose too
upvoted 1 times
...
Jayanth
1 year, 5 months ago
C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
upvoted 1 times
...
Busi57
1 year, 5 months ago
Selected Answer: C
C i choose
upvoted 1 times
...
cdechery
1 year, 5 months ago
Selected Answer: C
If there is no output defined for the resource, the "output" command will not show anything. Correct is C.
upvoted 2 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