[Feb-2022] Free TA-002-P Exam Questions TA-002-P Actual Free Exam Questions [Q123-Q146]

Share

[Feb-2022] Free TA-002-P Exam Questions TA-002-P Actual Free Exam Questions

Verified TA-002-P dumps and 324 unique questions

NEW QUESTION 123
You want to use terraform import to start managing infrastructure that was not originally provisioned through infrastructure as code. Before you can import the resource's current state, what must you do in order to prepare to manage these resources using Terraform?

  • A. Run terraform refresh to ensure that the state file has the latest information for existing resources.
  • B. Update the configuration file to include the new resources.
  • C. Shut down or stop using the resources being imported so no changes are inadvertently missed.
  • D. Modify the Terraform state file to add the new resources.

Answer: B

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.
The terraform import command is used to import existing infrastructure.
To import a resource, first write a resource block for it in our configuration, establishing the name by which it will be known to Terraform.
Example:
resource "aws_instance" "import_example" {
# ...instance configuration...
}
Now terraform import can be run to attach an existing instance to this resource configuration.
$ terraform import aws_instance.import_example i-03efafa258104165f
aws_instance.import_example: Importing from ID "i-03efafa258104165f"...
aws_instance.import_example: Import complete!
Imported aws_instance (ID: i-03efafa258104165f)
aws_instance.import_example: Refreshing state... (ID: i-03efafa258104165f) Import successful!
The resources that were imported are shown above. These resources are now in your Terraform state and will henceforth be managed by Terraform.
This command locates the AWS instance with ID i-03efafa258104165f (which has been created outside Terraform) and attaches its existing settings, as described by the EC2 API, to the name aws_instance.import_example in the Terraform state.

 

NEW QUESTION 124
The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.

  • A. True
  • B. False

Answer: A

Explanation:
https://www.terraform.io/docs/commands/init.html

 

NEW QUESTION 125
Given the Terraform configuration below, in which order will the resources be created?

  • A. aws_eip will be created first aws_instance will be created second
  • B. aws_instance will be created first aws_eip will be created second
  • C. resources will be created simultaneously
  • D. Larger image

Answer: B

Explanation:
The aws_instance will be created first, and then aws_eip will be created second due to the aws_eip's resource dependency of the aws_instance id

 

NEW QUESTION 126
In Terraform Enterprise, a workspace can be mapped to how many VCS repos?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: C

Explanation:
A workspace can only be configured to a single VCS repo, however, multiple workspaces can use the same repo.
https://www.terraform.io/docs/cloud/workspaces/vcs.html

 

NEW QUESTION 127
You can migrate the Terraform backend but only if there are no resources currently being managed.

  • A. False
  • B. True

Answer: A

Explanation:
Explanation
If you need to migrate to another backend, such as Terraform Cloud, so you can continue managing it. By migrating your Terraform state, you can hand off infrastructure without de-provisioning anything.
https://www.terraform.io/docs/cloud/migrate/index.html

 

NEW QUESTION 128
Which one of the following will run echo 0 and echo 1 on a newly created host?

  • A. provisioner "remote-exec" {
    inline = [
    "echo 0",
    "echo 1"
    ]
    }
  • B. provisioner "remote-exec" {
    inline = [
    echo 0,
    echo 1
    ]
    }
  • C. provisioner "local-exec" { command = "echo 0"
    command = "echo 1"
    }
  • D. provisioner "remote-exec" {
    command = "${echo 0}"
    command = "${echo 1}"
    }

Answer: A

Explanation:
Explanation
remote-exec Provisioner
Example usage
resource "aws_instance" "web" {
# ...
provisioner "remote-exec" {
inline = [
"puppet apply",
"consul join ${aws_instance.web.private_ip}",
]
}
}

 

NEW QUESTION 129
Given the Terraform configuration below, in which order will the resources be created?
1. resource "aws_instance" "web_server"
2. {
3. ami = "ami-b374d5a5"
4. instance_type = "t2.micro"
5. }
6. resource "aws_eip" "web_server_ip"
7. {
8. vpc = true instance = aws_instance.web_server.id
9. }

  • A. Resources will be created simultaneously
  • B. aws_eip will be created first
    aws_instance will be created second
  • C. aws_eip will be created first
    aws_instance will be created second
  • D. aws_instance will be created first
    aws_eip will be created second

Answer: D

Explanation:
Implicit and Explicit Dependencies
By studying the resource attributes used in interpolation expressions, Terraform can automatically infer when one resource depends on another. In the example above, the reference to aws_instance.web_server.id creates an implicit dependency on the aws_instance named web_server.
Terraform uses this dependency information to determine the correct order in which to create the different resources.
# Example of Implicit Dependency
resource "aws_instance" "web_server" {
ami = "ami-b374d5a5"
instance_type = "t2.micro"
}
resource "aws_eip" "web_server_ip" {
vpc = true
instance = aws_instance.web_server.id
}
In the example above, Terraform knows that the aws_instance must be created before the aws_eip.
Implicit dependencies via interpolation expressions are the primary way to inform Terraform about these relationships, and should be used whenever possible.
Sometimes there are dependencies between resources that are not visible to Terraform. The depends_on argument is accepted by any resource and accepts a list of resources to create explicit dependencies for.
For example, perhaps an application we will run on our EC2 instance expects to use a specific Amazon S3 bucket, but that dependency is configured inside the application code and thus not visible to Terraform. In that case, we can use depends_on to explicitly declare the dependency:
# Example of Explicit Dependency
# New resource for the S3 bucket our application will use.
resource "aws_s3_bucket" "example" {
bucket = "terraform-getting-started-guide"
acl = "private"
}
# Change the aws_instance we declared earlier to now include "depends_on" resource "aws_instance" "example" { ami = "ami-2757f631" instance_type = "t2.micro"
# Tells Terraform that this EC2 instance must be created only after the
# S3 bucket has been created.
depends_on = [aws_s3_bucket.example]
}
https://learn.hashicorp.com/terraform/getting-started/dependencies.html

 

NEW QUESTION 130
What is one disadvantage of using dynamic blocks in Terraform?

  • A. Dynamic blocks can construct repeatable nested blocks
  • B. They cannot be used to loop through a list of values
  • C. They make configuration harder to read and understand
  • D. Terraform will run more slowly

Answer: B

 

NEW QUESTION 131
You have configured an Auto Scaling group in AWS to automatically scale the number of instances behind a load balancer based on the instances CPU utilization. The instances are configured using a Launch Configuration. You have observed that the Auto Scaling group doesn't successfully scale when you apply changes that require replacing the Launch Configuration. Why is this happening?

  • A. You need to configure an explicit dependency for the Auto Scaling group using the depends_on meta-parameter.
  • B. You need to configure the Auto Scaling group's create_before_destroy meta-parameter.
  • C. You need to configure an explicit dependency for the Launch Configuration using the depends_on meta-parameter.
  • D. You need to configure the Launch Configuration's create_before_destroy meta-parameter.

Answer: D

Explanation:
Explanation
https://www.terraform.io/docs/providers/aws/r/launch_configuration.html#using-withautoscaling-groups

 

NEW QUESTION 132
A user creates three workspaces from the command line - prod, dev, and test. Which of the following commands will the user run to switch to the dev workspace?

  • A. terraform workspace select dev
  • B. terraform workspace dev
  • C. terraform workspace switch dev
  • D. terraform workspace -switch dev

Answer: A

Explanation:
Explanation
The terraform workspace select command is used to choose a different workspace to use for further operations. https://www.terraform.io/docs/commands/workspace/select.html

 

NEW QUESTION 133
During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

  • A. the resource is marked as tainted
    Explanation
    If a resource successfully creates but fails during provisioning, Terraform will error and mark the resource as "tainted". A resource that is tainted has been physically created, but can't be considered safe to use since provisioning failed. Terraform also does not automatically roll back and destroy the resource during the apply when the failure happens, because that would go against the execution plan: the execution plan would've said a resource will be created, but does not say it will ever be deleted.
  • B. Terraform attempts to provision the resource up to three times before exiting with an error
  • C. the terraform plan is rolled back and all provisioned resources are removed
  • D. it is automatically deleted

Answer: A

 

NEW QUESTION 134
By default, where does Terraform store its state file?

  • A. shared directory
  • B. Amazon S3 bucket
  • C. current working directory
    Explanation
    By default, the state file is stored in a local file named "terraform.tfstate", but it can also be stored remotely, which works better in a team environment.
  • D. remotely using Terraform Cloud

Answer: C

 

NEW QUESTION 135
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?

  • A. terraform recreate
  • B. terraform destroy
  • C. terraform taint
  • D. terraform refresh

Answer: C

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

 

NEW QUESTION 136
What is the command you can use to set an environment variable named "var1"of type String?

  • A. variable "var1" { type = "string"}
  • B. export TF_VAR_var1
  • C. set TF_VAR_var1
  • D. export TF_VAR_VAR1

Answer: B

Explanation:
The environment variable must be in the format TF_VAR_name, so for the

 

NEW QUESTION 137
terraform state subcommands such as list are read-only commands, do read-only commands create state backup files?

  • A. No
  • B. Yes

Answer: A

Explanation:
Subcommands that are read-only (such as list) do not write any backup files since they aren't modifying the state.
All terraform state subcommands that modify the state write backup files. The path of these backup file can be controlled with -backup.
https://www.terraform.io/docs/commands/state/index.html#backups

 

NEW QUESTION 138
Workspaces in Terraform provides similar functionality in the open-source, Terraform Cloud, and Enterprise versions of Terraform.

  • A. False
  • B. True

Answer: A

Explanation:
Explanation
https://www.terraform.io/docs/cloud/migrate/workspaces.html
Workspaces, managed with the terraform workspace command, aren't the same thing as Terraform Cloud's workspaces. Terraform Cloud workspaces act more like completely separate working directories; CLI workspaces are just alternate state files.

 

NEW QUESTION 139
Which of the following clouds does not have a provider maintained HashiCorp?

  • A. IBM Cloud
  • B. DigitalOcean
  • C. OpenStack
  • D. AWS

Answer: A

Explanation:
Explanation
IBM Cloud does not have a provider maintained by HashiCorp, although IBM Cloud does maintain their own Terraform provider.
https://www.terraform.io/docs/providers/index.html

 

NEW QUESTION 140
Your manager has instructed you to start using terraform for the entire infra provisioning of the application stack. There are 4 environments - DEV , QA , UAT , and PROD. The application team has asked for complete segregation between these environments including the backend , state , and also configurations ,since there will be unique resources in different environments . What is the possible way to structure the terraform code to facilitate that.

  • A. Completely separate the working directories , keep one for each environment . For each working directory , maintain a separate configuration file , variables file , and map to the same backend.
  • B. Implement terraform workspaces , and map each environment with one workspace.
  • C. Enable remote backend storage . Configure 4 different backend storages , one for each environment.
  • D. Completely separate the working directories , keep one for each environment . For each working directory , maintain a separate configuration file , variables file , and map to a different backend.

Answer: D

Explanation:
Explanation
In particular, organizations commonly want to create a strong separation between multiple deployments of the same infrastructure serving different development stages (e.g. staging vs. production) or different internal teams. In this case, the backend used for each deployment often belongs to that deployment, with different credentials and access controls. Named workspaces are not a suitable isolation mechanism for this scenario.
https://www.terraform.io/docs/state/workspaces.html

 

NEW QUESTION 141
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 142
Taint the resource "aws_instance" "baz" resource that lives in module bar which lives in module foo.

  • A. terraform taint module.foo.module.bar.baz
  • B. terraform taint foo.bar.aws_instance.baz
  • C. terraform taint module.foo.bar.aws_instance.baz
  • D. terraform taint module.foo.module.bar.aws_instance.baz

Answer: D

Explanation:
Check resource addressing
https://www.terraform.io/docs/internals/resource-addressing.html

 

NEW QUESTION 143
Terraform provisioners can be added to any resource block.

  • A. True
  • B. False

Answer: A

 

NEW QUESTION 144
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.

  • A. True
  • B. False

Answer: A

 

NEW QUESTION 145
Which of the following is the right substitute for static values that can make Terraform configuration file more dynamic and reusable?

  • A. Functions
  • B. Modules
  • C. Input parameters
  • D. Output value

Answer: C

Explanation:
Input variables serve as parameters for a Terraform module, allowing aspects of the module to be customized without altering the module's own source code, and allowing modules to be shared between different configurations.

 

NEW QUESTION 146
......

Latest 100% Passing Guarantee - Brilliant TA-002-P Exam Questions PDF: https://www.examdumpsvce.com/TA-002-P-valid-exam-dumps.html

TA-002-P Dumps for Pass Guaranteed - Pass TA-002-P Exam: https://drive.google.com/open?id=1HARZedy9DTQ20wi--Zd5bGzxgoUGWkjW