[Oct 22, 2022] TA-002-P certification guide Q&A from Training Expert PrepPDF
TA-002-P Certification Overview Latest TA-002-P PDF Dumps
NEW QUESTION 39
A terraform apply can not _________ infrastructure.
- A. destroy
- B. provision
- C. change
- D. import
Answer: C
NEW QUESTION 40
How is the Terraform remote backend different than other state backends such as S3, Consul, etc.?
- A. It doesn't show the output of a terraform apply locally
- B. It can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud
- C. It is only available to paying customers
- D. All of the above
Answer: B
Explanation:
Explanation
If you and your team are using Terraform to manage meaningful infrastructure, we recommend using the remote backend with Terraform Cloud or Terraform Enterprise.
Reference: https://www.terraform.io/docs/language/settings/backends/index.html
NEW QUESTION 41
From the answers below, select the advantages of using Infrastructure as Code.
- A. Provide a codified workflow to develop customer-facing applications.
- B. Easily change and update existing infrastructure.
- C. Easily integrate with application workflows (GitLab Actions, Azure DevOps, CI/CD tools).
- D. Safely test modifications using a "dry run" before applying any actual changes.
- E. Provide reusable modules for easy sharing and collaboration.
Answer: B,C,D,E
Explanation:
Explanation
Infrastructure as Code is not used to develop applications, but it can be used to help deploy or provision those applications to a public cloud provider or on-premises infrastructure.
All of the others are benefits to using Infrastructure as Code over the traditional way of managing infrastructure, regardless if it's public cloud or on-premises.
NEW QUESTION 42
Which Terraform command will force a marked resource to be destroyed and recreated on the next apply?
- A. terraform taint
- B. terraform destroy
- C. terraform refresh
- D. terraform fmt
Answer: A
Explanation:
The terraform taint command manually marks a Terraform-managed resource as tainted, forcing it to be destroyed and recreated on the next apply.
This command will not modify infrastructure, but does modify the state file in order to mark a resource as tainted. Once a resource is marked as tainted, the next plan will show that the resource will be destroyed and recreated and the next apply will implement this change.
Forcing the recreation of a resource is useful when you want a certain side effect of recreation that is not visible in the attributes of a resource. For example: re-running provisioners will cause the node to be different or rebooting the machine from a base image will cause new startup scripts to run.
Note that tainting a resource for recreation may affect resources that depend on the newly tainted resource. For example, a DNS resource that uses the IP address of a server may need to be modified to reflect the potentially new IP address of a tainted server. The plan command will show this if this is the case.
https://www.terraform.io/docs/commands/taint.html
NEW QUESTION 43
Your team uses terraform OSS . You have created a number of resuable modules for important , independent network components that you want to share with your team to enhance consistency . What is the correct option/way to do that?
- A. Terraform module sharing is only available in Enterprise version via terraform private module registry , so no way to enable it in OSS version.
- B. Terraform modules cannot be shared in OSS version . Each developer needs to maintain their own modules and leverage them in the main tf file.
- C. Store your modules in a NAS/ shared file server , and ask your team members to directly reference the code from there. This is the only viable option in terraform OSS ,which is better than individually maintaining module versions for every developer.
- D. Upload your modules with proper versioning in the terraform public module registry . Terraform OSS is directly integrated with the public module registry , and can reference the modules from the code in the main tf file.
Answer: D
Explanation:
Explanation
Software development encourages code reuse through reusable artifacts, such as libraries, packages and modules. Most programming languages enable developers to package and publish these reusable components and make them available on a registry or feed. For example, Python has Python Package Index and PowerShell has PowerShell Gallery.
For Terraform users, the Terraform Registry enables the distribution of Terraform modules, which are reusable configurations. The Terraform Registry acts as a centralized repository for module sharing, making modules easier to discover and reuse.
The Registry is available in two variants:
* Public Registry houses official Terraform providers -- which are services that interact with an API to expose and manage a specific resource -- and community-contributed modules.
* Private Registry is available as part of the Terraform Cloud, and can host modules internally within an organization.
https://www.terraform.io/docs/registry/index.html
NEW QUESTION 44
Eric needs to make use of module within his terraform code. Should the module always be public and open-source to be able to be used?
- A. True
- B. False
Answer: B
Explanation:
Explanation
Terraform module need not be public and open-source. Module can be placed in -
* Local paths
* Terraform Registry
* GitHub
* Bitbucket
* Generic Git, Mercurial repositories
* HTTP URLs
* S3 buckets
* GCS buckets
https://www.terraform.io/docs/modules/sources.html
NEW QUESTION 45
In terraform, most resource dependencies are handled automatically. Which of the following statements describes best how terraform resource dependencies are handled?
- A. Resource dependencies are handled automatically by the depends_on meta_argument, which is set to true by default.
- B. The terraform binary contains a built-in reference map of all defined Terraform resource dependencies. Updates to this dependency map are reflected in terraform versions. To ensure you are working with the latest resource dependency map you much be running the latest version of Terraform.
- C. Terraform analyses any expressions within a resource block to find references to other objects, and treats those references as implicit ordering requirements when creating, updating, or destroying resources.
Explanation
https://www.terraform.io/docs/configuration/resources.html - D. Resource dependencies are identified and maintained in a file called resource.dependencies. Each terraform provider is required to maintain a list of all resource dependencies for the provider and it's included with the plugin during initialization when terraform init is executed. The file is located in the terraform.d folder.
Answer: C
NEW QUESTION 46
You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead.
What are the two things you must do to achieve this? (Choose two.)
- A. Write Terraform configuration for the existing VMs
- B. Run the terraform import-gcp command
- C. Provision new VMs using Terraform with the same VM names
- D. Use the terraform import command for the existing VMs
Answer: B,D
Explanation:
The terraform import command is used to import existing infrastructure.
Import existing Google Cloud resources into Terraform with Terraformer.
Reference: https://www.terraform.io/docs/cli/import/usage.html
https://cloud.google.com/docs/terraform
NEW QUESTION 47
Which of the following Terraform files should be ignored by Git when committing code to a repo? (select Three)
- A. Any files with names ending in .auto.tfvars or .auto.tfvars.json.
- B. Files named exactly terraform.tfvars or terraform.tfvars.json.
- C. terraform.tfstate
- D. input.tf
- E. output.tf
Answer: A,B,C
Explanation:
Explanation
The .gitignore file should be configured to ignore Terraform files that either contain sensitive data or are not required to save.
Terraform state (terraform.tfstate) can contain sensitive data, depending on the resources in use and your definition of "sensitive." The state contains resource IDs and all resource attributes. For resources such as databases, this may contain initial passwords.
When using local state, state is stored in plain-text JSON files.
The terraform.tfvars file may contain sensitive data, such as passwords or IP addresses of an environment that you may not want to share with others.
NEW QUESTION 48
Only the user that generated a plan may apply it.
- A. True
- B. False
Answer: A
Explanation:
The optional -out argument can be used to save the generated plan to a file for later execution with terraform apply, which can be useful when running Terraform in automation.
Reference: https://learn.hashicorp.com/tutorials/terraform/automate-terraform
NEW QUESTION 49
How would you reference the "name" value of the second instance of this fictitious resource?
- A. aws_instance.web[1]
- B. element(aws_instance.web, 2)
- C. aws_instance.web[1].name
- D. aws_instance.web.*.name
- E. aws_instance.web[2].name
Answer: B
NEW QUESTION 50
Which of the following does terraform apply change after you approve the execution plan? Choose two correct answers.
- A. Cloud infrastructure
- B. State file
- C. The execution plan
- D. The .terraform directory
- E. Terraform code
Answer: A,B
NEW QUESTION 51
If you delete a remote backend from the configuration, will you need to rebuild your state files locally?
- A. True
- B. False
Answer: B
Explanation:
Explanation
You can change your backend configuration at any time. You can change both the configuration itself as well as the type of backend (for example from "consul" to "s3").
Terraform will automatically detect any changes in your configuration and request a reinitialization. As part of the reinitialization process, Terraform will ask if you'd like to migrate your existing state to the new configuration. This allows you to easily switch from one backend to another.
https://www.terraform.io/docs/backends/config.html#changing-configuration
NEW QUESTION 52
You have created an AWS EC2 instance of type t2.micro through your terraform configuration file ec2.tf . Now you want to change the instance type from t2.micro to t2.medium. Accordingly you have changed your configuration file and and ran terraform plan. After running terraform plan you check the output and saw one instance will be updated from t2.micro --> t2.medium. After this you went to grab a coffee without running terraform apply and meanwhile a member of your team changed the instance type of that EC2 instance to t2.medium from aws console. After coming to your desk you run terraform apply. What will happen?
- A. terraform apply will through an error.
- B. No resource will be updated and you will see the message : Apply Complete ! Resources : 0 added, 0 changed, 0 destroyed.
- C. 1 resource will be updated and you will see the message : Apply Complete ! Resources : 0 added, 1 changed, 0 destroyed.
- D. The instance type will be changed to t2.micro and again will be changed to t2.medium
Answer: B
NEW QUESTION 53
Which of the below options is a valid interpolation syntax for retrieving a data source?
- A. ${azurerm_resource_group.test.data}
- B. ${google_storage_bucket.backend}
- C. ${data.google_dns_keys.foo_dns_keys.key_signing_keys[0].ds_record}
- D. ${aws_instance.web.id.data}
Answer: C
Explanation:
Data source attributes are interpolated with the general syntax data.TYPE.NAME.ATTRIBUTE. The interpolation for a resource is the same but without the data. prefix (TYPE.NAME.ATTRIBUTE).
https://www.terraform.io/docs/configuration-0-11/interpolation.html#attributes-of-a-data-source
NEW QUESTION 54
What is the provider for this fictitious resource?
- A. test
- B. aws
- C. main
- D. vpc
Answer: B
NEW QUESTION 55
ABC Enterprise has recently tied up with multiple small organizations for exchanging database information.
Due to this, the firewall rules are increasing and are more than 100 rules. This is leading firewall configuration file that is difficult to manage. What is the way this type of configuration can be managed easily?
- A. Dynamic Blocks
- B. Terraform Backends
- C. Terraform Expression
- D. Terraform Functions
Answer: A
NEW QUESTION 56
Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements.
(select three)
- A. The module must be on GitHub and must be a public repo.
- B. Module repositories must use this three-part name format, terraform-- .
- C. Release tag names must be for the format x.y.z, and can optionally be prefixed with a v .
- D. The module must be PCI/HIPPA compliant.
- E. The registry uses tags to identify module versions.
Answer: A,C,E
Explanation:
Explanation
https://www.terraform.io/docs/registry/modules/publish.html#requirements
NEW QUESTION 57
Command terraform refresh will update state file?
- A. True
- B. False
Answer: A
Explanation:
Explanation
The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. This can be used to detect any drift from the last-known state, and to update the state file.
This does not modify infrastructure, but does modify the state file. If the state is changed, this may cause changes to occur during the next plan or apply.
https://www.terraform.io/docs/commands/refresh.html
NEW QUESTION 58
resource "aws_s3_bucket" "example" { bucket = "my-test-s3-terraform-bucket" ...} resource "aws_iam_role"
"test_role" { name = "test_role" ...}
Due to the way that the application code is written , the s3 bucket must be created before the test role is created , otherwise there will be a problem. How can you ensure that?
- A. This is not possible to control in terraform . Terraform will take care of it in a native way , and create a dependency graph that is best suited for the parallel resource creation.
- B. Create 2 separate terraform config scripts , and run them one by one , 1 for s3 bucket , and another for IAM role , run the S3 bucket script first.
- C. Add explicit dependency using depends_on . This will ensure the correct order of resource creation.
- D. This will already be taken care of by terraform native implicit dependency. Nothing else needs to be done from your end.
Answer: C
Explanation:
Explanation
Use the depends_on meta-argument to handle hidden resource dependencies that Terraform can't automatically infer.
Explicitly specifying a dependency is only necessary when a resource relies on some other resource's behavior but doesn't access any of that resource's data in its arguments.
NEW QUESTION 59
In the example below, the depends_on argument creates what type of dependency?
- A. non-dependency resource
- B. explicit dependency
- C. internal dependency
- D. implicit dependency
Answer: B
NEW QUESTION 60
What is the result of the following terraform function call?
- A. what?
- B. goodbye
- C. hello
Answer: A
Explanation:
https://www.terraform.io/docs/configuration/functions/lookup.html
NEW QUESTION 61
Which of the following state management command allow you to retrieve a list of resources that are part of the state file?
- A. terraform list
- B. terraform state view
- C. terraform state list
- D. terraform view
Answer: C
Explanation:
The terraform state list command is used to list resources within a Terraform state.
Usage: terraform state list [options] [address...]
The command will list all resources in the state file matching the given addresses (if any). If no addresses are given, all resources are listed.
https://www.terraform.io/docs/commands/state/list.html
NEW QUESTION 62
Which of these is the best practice to protect sensitive values in state files?
- A. Secure Sockets Layer (SSL)
- B. Signed Terraform providers
- C. Blockchain
- D. Enhanced remote backends
Answer: D
Explanation:
Explanation
Use of remote backends and especially the availability of Terraform Cloud, there are now a variety of backends that will encrypt state at rest and will not store the state in cleartext on machines running. Reference:
https://www.terraform.io/docs/extend/best-practices/sensitive-state.html
NEW QUESTION 63
......
The Best HashiCorp TA-002-P Study Guides and Dumps of 2022: https://certkingdom.preppdf.com/HashiCorp/TA-002-P-prepaway-exam-dumps.html