Free TA-002-P Exam Braindumps

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

  1. True
  2. False

Answer(s): B

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



Command terraform refresh will update state file?

  1. False
  2. True

Answer(s): B

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



State locking does not happen automatically and must be specified at run

  1. False
  2. True

Answer(s): A

Explanation:

State locking happens automatically on all operations that could write state.
https://www.terraform.io/docs/state/locking.html



Which of the below options is a valid interpolation syntax for retrieving a data source?

  1. ${google_storage_bucket.backend}
  2. ${azurerm_resource_group.test.data}
  3. ${aws_instance.web.id.data}
  4. ${data.google_dns_keys.foo_dns_keys.key_signing_keys[0].ds_record}

Answer(s): D

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



Jim has created several AWS resources from a single terraform configuration file. Someone from his team has manually modified one of the EC2 instance.
Now to discard the manual change, Jim wants to destroy and recreate the EC2 instance. What is the best way to do it?

  1. terraform recreate
  2. terraform taint
  3. terraform destroy
  4. terraform refresh

Answer(s): B

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.
This example will taint a single resource:
$ terraform taint aws_security_group.allow_all
The resource aws_security_group.allow_all in the module root has been marked as tainted.
https://www.terraform.io/docs/commands/taint.html