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 194 discussion

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

You can access state stored with the local backend by using the terraform_remote_state data source.

  • A. True
  • B. False
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
Stanislav4907
Highly Voted 1 year, 7 months ago
Selected Answer: A
The terraform_remote_state data source allows you to retrieve outputs from the state of another Terraform configuration, which can be stored in a local or remote backend. To use the terraform_remote_state data source with a local backend, you would define the path to the state file in the backend configuration block of your Terraform configuration, and then use that path in the data "terraform_remote_state" block to retrieve the desired output values.
upvoted 11 times
...
FarziWaliMarzi
Highly Voted 1 year, 7 months ago
Selected Answer: A
https://developer.hashicorp.com/terraform/language/state/remote-state-data data "terraform_remote_state" "vpc" { backend = "local" config = { path = "..." } } # Terraform >= 0.12 resource "aws_instance" "foo" { # ... subnet_id = data.terraform_remote_state.vpc.outputs.subnet_id } # Terraform <= 0.11 resource "aws_instance" "foo" { # ... subnet_id = "${data.terraform_remote_state.vpc.subnet_id}" }
upvoted 7 times
...
lavendran93
Most Recent 2 months, 1 week ago
Selected Answer: B
The terraform_remote_state data source is used to access state from a remote backend, such as S3, Azure Blob Storage, or Terraform Cloud. It does not work with the local backend. The local backend stores the state file on your local filesystem, and to access it, you need to handle it directly, not through terraform_remote_state.
upvoted 1 times
...
master9
4 months, 1 week ago
Selected Answer: B
As asking for Local not remote state file
upvoted 2 times
...
VSMu
1 year, 4 months ago
Selected Answer: A
Example https://developer.hashicorp.com/terraform/language/state/remote-state-data#example-usage-local-backend
upvoted 2 times
...
Nunyabiznes
1 year, 7 months ago
Selected Answer: B
The terraform_remote_state data source is used to access state data stored in a remote backend (such as S3, GCS, or Terraform Cloud). It is not designed to access local backend state files directly. However, if you want to access data from another Terraform configuration's local state, you can use output variables and pass the values between configurations using input variables or other methods.
upvoted 2 times
...
camps
1 year, 7 months ago
Selected Answer: B
The terraform_remote_state data source is used to access the state data from another Terraform configuration that is stored in a remote backend, not a local backend. This data source enables you to fetch the outputs of another Terraform project and use them as input variables in your current Terraform project. When using the local backend, the Terraform state is stored in a local file (usually named terraform.tfstate). This means the state is not accessible through the terraform_remote_state data source, as it is not stored remotely.
upvoted 2 times
SaadKhamis
1 year, 7 months ago
It is possible to use it to access local backend. https://developer.hashicorp.com/terraform/language/state/remote-state-data#example-usage-local-backend data "terraform_remote_state" "vpc" { backend = "local" config = { path = "..." } }
upvoted 3 times
...
...
Strib
1 year, 8 months ago
Selected Answer: A
Example Usage (local Backend) https://developer.hashicorp.com/terraform/language/state/remote-state-data#example-usage-local-backend
upvoted 3 times
...
David_C_90
1 year, 8 months ago
Selected Answer: A
I tested this and I believe this is correct. Check the link https://developer.hashicorp.com/terraform/language/state/remote-state-data#example-usage-local-backend Note that the state file must already exist and the data you will obtain is the data present on the file: if you change the terraform configuration corresponding to the state you are trying to read, you will obtain the "old" data.
upvoted 2 times
...
khaled_razouk
1 year, 8 months ago
Selected Answer: B
I'll go with B
upvoted 1 times
...
rotimislaw
1 year, 9 months ago
Selected Answer: B
Seems B to me
upvoted 1 times
...
shahin_am2
1 year, 9 months ago
B. False. According to the Terraform documentation, the terraform_remote_state data source can be used to access state data stored in a remote backend. This allows you to use output values from one Terraform configuration as input values for another configuration. However, the local backend is not considered a remote backend, because it stores state data locally on disk. Therefore, you cannot use the terraform_remote_state data source to access state stored with the local backend.
upvoted 2 times
...
princajen
1 year, 9 months ago
Selected Answer: B
B. False. The terraform_remote_state data source is used to fetch outputs from the state of a different Terraform configuration, which is stored remotely, and use them as input for the current configuration. It is used with remote backends, not local ones.
upvoted 2 times
...
pyro7
1 year, 9 months ago
False. The local backend stores state locally on the same machine as the Terraform configuration files, and it is not accessible over a network connection. To access state stored in a remote backend, you need to use the terraform_remote_state data source.
upvoted 1 times
...
Abuu
1 year, 9 months ago
Selected Answer: A
this is correct. The terraform_remote_state data source allows you to access state stored with the local backend, enabling you to share and reference state between different configurations. This is especially useful when using multiple configurations to manage different parts of the same infrastructure.
upvoted 2 times
...
Daro_
1 year, 9 months ago
Selected Answer: A
As per below documentation https://developer.hashicorp.com/terraform/language/state/remote-state-data and example of configuration data "terraform_remote_state" "vpc" { backend = "local" config = { path = "..." } } Answer is: [ A ]
upvoted 4 times
lezgino
1 year, 9 months ago
The terraform_remote_state data source is used to access state stored with a remote backend, such as S3 or Consul. You cannot access state stored with the local backend using the terraform_remote_state data source.
upvoted 1 times
...
...
Daro_
1 year, 9 months ago
As per below documentation https://developer.hashicorp.com/terraform/language/state/remote-state-data and example of configuration data "terraform_remote_state" "vpc" { backend = "local" config = { path = "..." } } Answer is: [ A ]
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 ...