Free Terraform Associate Exam Braindumps (page: 35)

Page 34 of 113

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?

  1. It depends on which command issue related to.
  2. Python
  3. Go
  4. Java

Answer(s): C

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.



Terraform import command can import resources into modules as well directly into the root of your state.

  1. True
  2. False

Answer(s): A

Explanation:

Import will find the existing resource from ID and import it into your Terraform state at the given ADDRESS. ADDRESS must be a valid resource address. Because any resource address is valid, the import command can import resources into modules as well directly into the root of your state. Terraform is able to import existing infrastructure. This allows us take resources we've created by some other means (i.e. via console) and bring it under Terraform management.
This is a great way to slowly transition infrastructure to Terraform.
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. For 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.
As a result of the above command, the resource is recorded in the state file. We can now run terraform plan to see how the configuration compares to the imported resource, and make any adjustments to the configuration to align with the current (or desired) state of the imported object. https://www.terraform.io/docs/commands/import.html



Which of the following type of variable allows multiple values of several distinct types to be grouped together as a single value?

  1. Map
  2. Object
  3. Tuple
  4. List

Answer(s): B,C

Explanation:

Structural type of variable allows multiple values of several distinct types to be grouped together as a single value. They require a schema as an argument, to specify which types are allowed for which elements.


Reference:

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



Which of the following best describes the default local backend?

  1. The local backend is where Terraform Enterprise stores logs to be processed by an log collector.
  2. The local backend stores state on the local filesystem, locks the state using system APIs, and performs operations locally.
  3. The local backend is the directory where resources deployed by Terraform have direct access to in order to update their current state.
  4. The local backend is how Terraform connects to public cloud services, such as AWS, Azure, or GCP.

Answer(s): B

Explanation:

The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
terraform { backend "local" {
path = "relative/path/to/terraform.tfstate"
}
}


Reference:

https://www.terraform.io/docs/backends/types/local.html






Post your Comments and Discuss HashiCorp Terraform Associate exam with other Community members:

Terraform Associate Discussions & Posts