TA-002-P Exam Preparation Material with New TA-002-P Dumps Questions [Q45-Q65]

Share

TA-002-P Exam Preparation Material with New TA-002-P Dumps Questions

TA-002-P 2024 Training With 94 QA's

NEW QUESTION # 45
What are some of the features of Terraform state? (select three)

  • A. increased performance
  • B. mapping configuration to real-world resources
  • C. determining the correct order to destroy resources
  • D. inspection of cloud resources

Answer: A,B


NEW QUESTION # 46
Once you configure a new Terraform backend with a terraform code block, which command(s) should you use to migrate the state file?

  • A. terraform destroy, then terraform apply
  • B. terraform apply
  • C. terraform init
  • D. terraform push

Answer: C

Explanation:
This command will initialize the new backend and prompt you to migrate the existing state file to the new location4. The other commands are not relevant for this task.


NEW QUESTION # 47
terraform validate validate validates that your infrastructure matches the Terraform state file.

  • A. True
  • B. False

Answer: B

Explanation:
Explanation
The terraform validate command validates the configuration files in a directory, referring only to the
configuration and not accessing any remote services such as remote state, provider APIs, etc. Validate runs
checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any
provided variables or existing state. It is thus primarily useful for general verification of reusable modules,
including correctness of attribute names and value types. Source:
https://www.terraform.io/cli/commands/validate


NEW QUESTION # 48
The terraform.tfstate file always matches your currently built infrastructure.

  • A. True
  • B. False

Answer: B


NEW QUESTION # 49
Terraform validate reports syntax check errors from which of the following scenarios?

  • A. Code contains tabs indentation instead of spaces
  • B. The state files does not match the current infrastructure
  • C. There is missing value for a variable
  • D. None of the above

Answer: C


NEW QUESTION # 50
Dawn has created the below child module. Without changing the module, can she override the instance_type
from t2.micro to t2.large form her code while calling this module?
1. resource "aws_instance" "myec2"
2. {
3. ami = "ami-082b5a644766e0e6f"
4. instance_type = "t2.micro
5. }

  • A. YES
  • B. No

Answer: B

Explanation:
Explanation
As the instance_type is hard-coded in source module, you will not be able to change its value from destination
module. Instead of hard-coding you should use variable with default values.


NEW QUESTION # 51
Terraform init can indeed be run only a few times, because, every time terraform init will initialize the project
, and download all plugins from the internet repository , regardless of whether they were present or not , and
this increases the waiting time

  • A. True
  • B. False

Answer: B

Explanation:
Explanation
Re-running init with modules already installed will install the sources for any modules that were added to
configuration since the last init, but will not change any already-installed modules. Use -upgrade to override
this behavior, updating all modules to the latest available source code.
https://www.terraform.io/docs/commands/init.html


NEW QUESTION # 52
How is terraform import run?

  • A. All of the above
  • B. As a part of terraform init
  • C. By an explicit call
  • D. As a part of terraform refresh
  • E. As a part of terraform plan

Answer: C

Explanation:
Explanation
"The current implementation of Terraform import can only import resources into the state. It does not generate
configuration. A future version of Terraform will also generate configuration. Because of this, prior to running
terraform import it is necessary to write manually a resource configuration block for the resource, to which the
imported object will be mapped. While this may seem tedious, it still gives Terraform users an avenue for
importing existing resources." https://www.terraform.io/cli/import/usage


NEW QUESTION # 53
Terraform providers are always installed from the Internet.

  • A. True
  • B. False

Answer: B

Explanation:
Explanation
Terraform configurations must declare which providers they require, so that Terraform can install and use them.
Reference: https://www.terraform.io/docs/language/providers/configuration.html


NEW QUESTION # 54
When Terraform needs to be installed in a location where it does not have internet access to download the installer and upgrades, the installation is generally known as to be __________.

  • A. air-gapped
  • B. disconnected
  • C. a private install
  • D. non-traditional

Answer: D

Explanation:
Explanation
A Terraform Enterprise install that is provisioned on a network that does not have Internet access is generally known as an air-gapped install. These types of installs require you to pull updates, providers, etc. from external sources vs. being able to download them directly.


NEW QUESTION # 55
FILL BLANK
What is the name of the default file where Terraform stores the state?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct
answer are accepted.

Answer:

Explanation:
terraform.tfstate
"This state is stored by default in a local file named "terraform.tfstate", but it can also be stored remotely,
which works better in a team environment." https://www.terraform.io/language/state


NEW QUESTION # 56
State is a requirement for Terraform to function

  • A. True
  • B. False

Answer: A

Explanation:
Explanation
State is a necessary requirement for Terraform to function. It is often asked if it is possible for Terraform to
work without state, or for Terraform to not use state and just inspect cloud resources on every run.
Purpose of Terraform State
State is a necessary requirement for Terraform to function. It is often asked if it is possible for Terraform to
work without state, or for Terraform to not use state and just inspect cloud resources on every run. This page
will help explain why Terraform state is required.
As you'll see from the reasons below, state is required. And in the scenarios where Terraform may be able to
get away without state, doing so would require shifting massive amounts of complexity from one place (state)
to another place (the replacement concept).
1. Mapping to the Real World
Terraform requires some sort of database to map Terraform config to the real world. When you have a
resource resource "aws_instance" "foo" in your configuration, Terraform uses this map to know that instance i-
abcd1234 is represented by that resource.
For some providers like AWS, Terraform could theoretically use something like AWS tags. Early prototypes
of Terraform actually had no state files and used this method. However, we quickly ran into problems. The
first major issue was a simple one: not all resources support tags, and not all cloud providers support tags.
Therefore, for mapping configuration to resources in the real world, Terraform uses its own state structure.
2. Metadata
Alongside the mappings between resources and remote objects, Terraform must also track metadata such as
resource dependencies.
Terraform typically uses the configuration to determine dependency order. However, when you delete a
resource from a Terraform configuration, Terraform must know how to delete that resource. Terraform can see
that a mapping exists for a resource not in your configuration and plan to destroy. However, since the
configuration no longer exists, the order cannot be determined from the configuration alone.
To ensure correct operation, Terraform retains a copy of the most recent set of dependencies within the state.
Now Terraform can still determine the correct order for destruction from the state when you delete one or
more items from the configuration.
One way to avoid this would be for Terraform to know a required ordering between resource types. For
example, Terraform could know that servers must be deleted before the subnets they are a part of. The
complexity for this approach quickly explodes, however: in addition to Terraform having to understand the
ordering semantics of every resource for every cloud, Terraform must also understand the ordering across
providers.
Terraform also stores other metadata for similar reasons, such as a pointer to the provider configuration that
was most recently used with the resource in situations where multiple aliased providers are present.
3. Performance
In addition to basic mapping, Terraform stores a cache of the attribute values for all resources in the state. This
is the most optional feature of Terraform state and is done only as a performance improvement.
When running a terraform plan, Terraform must know the current state of resources in order to effectively
determine the changes that it needs to make to reach your desired configuration.
For small infrastructures, Terraform can query your providers and sync the latest attributes from all your
resources. This is the default behavior of Terraform: for every plan and apply, Terraform will sync all
resources in your state.
For larger infrastructures, querying every resource is too slow. Many cloud providers do not provide APIs to
query multiple resources at once, and the round trip time for each resource is hundreds of milliseconds. On top
of this, cloud providers almost always have API rate limiting so Terraform can only request a certain number
of resources in a period of time. Larger users of Terraform make heavy use of the -refresh=false flag as well as
the -target flag in order to work around this. In these scenarios, the cached state is treated as the record of
truth.
4. Syncing
In the default configuration, Terraform stores the state in a file in the current working directory where
Terraform was run. This is okay for getting started, but when using Terraform in a team it is important for
everyone to be working with the same state so that operations will be applied to the same remote objects.
Remote state is the recommended solution to this problem. With a fully-featured state backend, Terraform can
use remote locking as a measure to avoid two or more different users accidentally running Terraform at the
same time, and thus ensure that each Terraform run begins with the most recent updated state.


NEW QUESTION # 57
How is terraform import run?

  • A. All of the above
  • B. As a part of terraform init
  • C. As a part of terraform refresh
  • D. As a part of terraform plan
  • E. By an explicit call

Answer: D


NEW QUESTION # 58
What features does the hosted service Terraform Cloud provide? (Choose two.)

  • A. Remote state storage
  • B. A web-based user interface (UI)
  • C. Automated infrastructure deployment visualization
  • D. Automatic backups

Answer: A,D

Explanation:
Reference:
https://www.terraform.io/docs/enterprise/admin/automated-recovery.html https://www.terraform.io/docs/language/state/remote.html


NEW QUESTION # 59
You want to get involved in the development of Terraform. As this is an open source project, you would like
to contribute a fix for an open issue of Terraform. What programming language will need to use to write the
fix?

  • A. Java
  • B. Go
  • C. Python
  • D. It depends on which command issue related to.

Answer: B

Explanation:
Explanation
Basic programming knowledge. Terraform and Terraform Plugins are written in the Go programming
language, but even if you've never written a line of Go before, you're still welcome to take a dive into the code
and submit patches. The community is happy to assist with code reviews and offer guidance specific to Go.


NEW QUESTION # 60
How would you be able to reference an attribute from the vsphere_datacenter data source for use with the argument within the vsprere_folder resource in the following configuration?

  • A. vsphere_datacenter.dc.id
  • B. data.vsphere_datacenter.dc.id
  • C. data.vsphere_datacenter.dc
  • D. data.dc,id

Answer: B


NEW QUESTION # 61
State is a requirement for Terraform to function

  • A. True
  • B. False

Answer: A

Explanation:
Explanation
State is a necessary requirement for Terraform to function. It is often asked if it is possible for Terraform to work without state, or for Terraform to not use state and just inspect cloud resources on every run.
Purpose of Terraform State
State is a necessary requirement for Terraform to function. It is often asked if it is possible for Terraform to work without state, or for Terraform to not use state and just inspect cloud resources on every run. This page will help explain why Terraform state is required.
As you'll see from the reasons below, state is required. And in the scenarios where Terraform may be able to get away without state, doing so would require shifting massive amounts of complexity from one place (state) to another place (the replacement concept).
1. Mapping to the Real World
Terraform requires some sort of database to map Terraform config to the real world. When you have a resource resource "aws_instance" "foo" in your configuration, Terraform uses this map to know that instance i- abcd1234 is represented by that resource.
For some providers like AWS, Terraform could theoretically use something like AWS tags. Early prototypes of Terraform actually had no state files and used this method. However, we quickly ran into problems. The first major issue was a simple one: not all resources support tags, and not all cloud providers support tags.
Therefore, for mapping configuration to resources in the real world, Terraform uses its own state structure.
2. Metadata
Alongside the mappings between resources and remote objects, Terraform must also track metadata such as resource dependencies.
Terraform typically uses the configuration to determine dependency order. However, when you delete a resource from a Terraform configuration, Terraform must know how to delete that resource. Terraform can see that a mapping exists for a resource not in your configuration and plan to destroy. However, since the configuration no longer exists, the order cannot be determined from the configuration alone.
To ensure correct operation, Terraform retains a copy of the most recent set of dependencies within the state.
Now Terraform can still determine the correct order for destruction from the state when you delete one or more items from the configuration.
One way to avoid this would be for Terraform to know a required ordering between resource types. For example, Terraform could know that servers must be deleted before the subnets they are a part of. The complexity for this approach quickly explodes, however: in addition to Terraform having to understand the ordering semantics of every resource for every cloud, Terraform must also understand the ordering across providers.
Terraform also stores other metadata for similar reasons, such as a pointer to the provider configuration that was most recently used with the resource in situations where multiple aliased providers are present.
3. Performance
In addition to basic mapping, Terraform stores a cache of the attribute values for all resources in the state. This is the most optional feature of Terraform state and is done only as a performance improvement.
When running a terraform plan, Terraform must know the current state of resources in order to effectively determine the changes that it needs to make to reach your desired configuration.
For small infrastructures, Terraform can query your providers and sync the latest attributes from all your resources. This is the default behavior of Terraform: for every plan and apply, Terraform will sync all resources in your state.
For larger infrastructures, querying every resource is too slow. Many cloud providers do not provide APIs to query multiple resources at once, and the round trip time for each resource is hundreds of milliseconds. On top of this, cloud providers almost always have API rate limiting so Terraform can only request a certain number of resources in a period of time. Larger users of Terraform make heavy use of the -refresh=false flag as well as the -target flag in order to work around this. In these scenarios, the cached state is treated as the record of truth.
4. Syncing
In the default configuration, Terraform stores the state in a file in the current working directory where Terraform was run. This is okay for getting started, but when using Terraform in a team it is important for everyone to be working with the same state so that operations will be applied to the same remote objects.
Remote state is the recommended solution to this problem. With a fully-featured state backend, Terraform can use remote locking as a measure to avoid two or more different users accidentally running Terraform at the same time, and thus ensure that each Terraform run begins with the most recent updated state.


NEW QUESTION # 62
terraform validate reports HCL syntax errors.

  • A. True
  • B. False

Answer: A


NEW QUESTION # 63
You have used Terraform to create an ephemeral development environment in the cloud and are now ready to
destroy all the infrastructure described by your Terraform configuration. To be safe, you would like to first see
all the infrastructure that will be deleted by Terraform.
Which command should you use to show all of the resources that will be deleted? (Choose two.)

  • A. Run terraform plan -destroy.
  • B. Run terraform destroy and it will first output all the resources that will be deleted before prompting for
    approval.
  • C. Run terraform state rm *.
  • D. This is not possible. You can only show resources that will be created.

Answer: A,B

Explanation:
Reference: https://www.terraform.io/docs/cli/commands/state/rm.html


NEW QUESTION # 64
You have created a terraform script that uses a lot of new constructs that have been introduced in terraform v0.12. However, many developers who are cloning the script from your git repo, are using v0.11, and getting errors. What can be done from your end to solve this problem?

  • A. Force developer to use v0.12 by using terraform setting 'required_version' and set it to >=0.12.
  • B. Add a condition in front of each such specific construct, to check whether the running terraform version id v0.11 or v0.12, and ,work accordingly.
  • C. Refactor the code to support both v0.11, and v0.12. It might be a difficult process, but there is no other way.
  • D. Add comments in your code to tell developers to use v0.12 . If they use v0.11 , that should be their problem , which they need to figure out.

Answer: A

Explanation:
https://www.terraform.io/docs/configuration/terraform.html


NEW QUESTION # 65
......

Quickly and Easily Pass HashiCorp Exam with TA-002-P real Dumps: https://actualtests.test4engine.com/TA-002-P-real-exam-questions.html