Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 10


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?

Show Answer
Correct Answer: C

Given that no outputs were created in your Terraform code, running 'terraform output ip_address' will not yield any information. The best method to quickly find the IP address of the deployed resource is to run 'terraform state list' to find the name of the resource and then use 'terraform state show' followed by the resource name to display its attributes, which include the public IP address.

Discussion

43 comments
Sign in to comment
coco10kOption: C
Apr 22, 2022

You can find the info in the state. not A because you don't have to outputs defined.

RVivekOption: C
Aug 31, 2022

Not A- Since you have not defined Output Not B. You cannot write output from statafile C- works fine Not D -That will destroy the resource

Kowser
Apr 26, 2022

agreed correct answer is C

imtiaz01Option: C
Apr 27, 2022

C is the correct answer.

cjigOption: C
Jul 15, 2022

C is correct answer. https://www.terraform.io/cli/commands/state/show

babuappnet
Sep 20, 2022

C is the right one.

javibadilloOption: C
May 24, 2022

Agree with C

Ahmad_Terraform
Jun 22, 2022

C is correct answer

EltoothOption: C
Jun 26, 2022

C is correct answer.

RVivekOption: C
Sep 15, 2022

C is the only logical answer. A is wrong, since output is not defied

YonexOption: C
Oct 24, 2022

Answer should be "C" instead of "A" You don't have output in the code then how to return from "A"?

pedrogcOption: C
Dec 7, 2022

"..., you did not create any outputs". So A cannot be an option. It would be it there was an output defined with the desired configuration. With C is posible to get the answer, too. So C.

adoubanOption: C
Dec 9, 2022

C- is the correct answer, the question mentioned clearly that no output block is defined. so you can query the state using terraform state list to list down the resources_type.resource.name then use terraform show resource_type.resource_name to list down the state configuration that includes the IP address

andersonbispos42Option: C
Dec 27, 2022

The correct answer is C. Can't be A because no output was defined.

connecttozee
Apr 3, 2023

100% is C

cdecheryOption: C
Jul 16, 2023

If there is no output defined for the resource, the "output" command will not show anything. Correct is C.

otakuinsideOption: C
Sep 28, 2023

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

campsOption: C
Sep 24, 2024

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.

samimshaikhOption: C
Sep 24, 2024

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.

nharazOption: C
Sep 24, 2024

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.

fasaleAkshayOption: C
Sep 28, 2024

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.

MechanicOption: C
Apr 24, 2022

You can't output what is not defined as an output resource.

koneba1309
May 2, 2022

I feel even C is not correct, as it will not show you the attribute value. The correct command would be terraform state show

ashxosOption: C
May 9, 2022

If the output is not defined then you will not get any output using the command mentioned in Option 1. Hence it is better to search the Value in state file.

Kowser
May 24, 2022

Answer is C

Oyster
Jun 1, 2022

Answer is C

AzureGurl
Jun 12, 2022

Answer is C, I have tested it.

Mal_8Option: C
Feb 18, 2023

C is the correct answer.

alexsandroeOption: C
Feb 25, 2023

correct

Power123
Mar 28, 2023

C is correct

Ni33Option: C
May 8, 2023

C is the correct answer

SIAMIANJIOption: C
Jun 2, 2023

C is correct,

Shane_COption: C
Jul 4, 2023

C is the correct the answer. It can't be A as the output isn't defined

Busi57Option: C
Jul 23, 2023

C i choose

Jayanth
Jul 28, 2023

C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address

grogudevOption: C
Sep 23, 2023

C I choose too

gofavad926Option: C
Sep 29, 2023

C for sure

luke404Option: C
Nov 2, 2023

The question does not talk about any output defined so you can't expect one

Prat8
Nov 21, 2023

Is it C or A ?

brundabanm
Jun 11, 2024

C is the correct answer.

hrajkuma
Jul 12, 2024

vote for option C

SilentMilliOption: C
Sep 24, 2024

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.

Serg853377
Sep 26, 2024

Answer C