ExamGecko
Home Home / HashiCorp / Terraform Associate 003

HashiCorp Terraform Associate 003 Practice Test - Questions Answers, Page 2

Question list
Search
Search

A developer on your team is going lo leaf down an existing deployment managed by Terraform and deploy a new one. However, there is a server resource named aws instant.ubuntu[l] they would like to keep. What command should they use to tell Terraform to stop managing that specific resource?

A.
Terraform plan rm:aws_instance.ubuntu[1]
A.
Terraform plan rm:aws_instance.ubuntu[1]
Answers
B.
Terraform state rm:aws_instance.ubuntu[1]
B.
Terraform state rm:aws_instance.ubuntu[1]
Answers
C.
Terraform apply rm:aws_instance.ubuntu[1]
C.
Terraform apply rm:aws_instance.ubuntu[1]
Answers
D.
Terraform destory rm:aws_instance.ubuntu[1]
D.
Terraform destory rm:aws_instance.ubuntu[1]
Answers
Suggested answer: B

Explanation:

To tell Terraform to stop managing a specific resource without destroying it, you can use theterraform state rmcommand. This command will remove the resource from the Terraform state, which means that Terraform will no longer track or update the corresponding remote object. However, the object will still exist in the remote system and you can later useterraform importto start managing it again in a different configuration or workspace. The syntax for this command isterraform state rm , whereis the resource address that identifies the resource instance to remove. For example,terraform state rm aws_instance.ubuntu[1]will remove the second instance of theaws_instanceresource namedubuntufrom the state.Reference= :Command: state rm:Moving Resources

HashiCorp Configuration Language (HCL) supports user-denned functions.

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: B

Explanation:

HashiCorp Configuration Language (HCL) does not support user-defined functions. You can only use the built-in functions that are provided by the language. The built-in functions allow you to perform various operations and transformations on values within expressions. The general syntax for function calls is a function name followed by comma-separated arguments in parentheses, such asmax(5, 12, 9). You can find the documentation for all of the available built-in functions in the Terraform Registry or the Packer Documentation, depending on which tool you are using.Reference= :Functions - Configuration Language | Terraform:Functions - Configuration Language | Packer

Terraform providers are part of the Terraform core binary.

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: B

Explanation:

Terraform providers are not part of the Terraform core binary. Providers are distributed separately from Terraform itself and have their own release cadence and version numbers. Providers are plugins that Terraform uses to interact with various APIs, such as cloud providers, SaaS providers, and other services. You can find and install providers from the Terraform Registry, which hosts providers for most major infrastructure platforms. You can also load providers from a local mirror or cache, or develop your own custom providers. To use a provider in your Terraform configuration, you need to declare it in the provider requirements block and optionally configure its settings in the provider block.Reference= :Providers - Configuration Language | Terraform:Terraform Registry - Providers Overview | Terraform

How could you reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration?

A.
Data.vsphere_datacenter.DC.id
A.
Data.vsphere_datacenter.DC.id
Answers
B.
Vsphere_datacenter.dc.id
B.
Vsphere_datacenter.dc.id
Answers
C.
Data,dc,id
C.
Data,dc,id
Answers
D.
Data.vsphere_datacenter,dc
D.
Data.vsphere_datacenter,dc
Answers
Suggested answer: A

Explanation:

The correct way to reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration isdata.vsphere_datacenter.dc.id. This follows the syntax for accessing data source attributes, which isdata.TYPE.NAME.ATTRIBUTE. In this case, the data source type isvsphere_datacenter, the data source name isdc, and the attribute we want to access isid. The other options are incorrect because they either use the wrong syntax, the wrong punctuation, or the wrong case.Reference= [Data Source: vsphere_datacenter], [Data Source: vsphere_folder], [Expressions: Data Source Reference]

Which of the following module source paths does not specify a remote module?

A.
Source = ''module/consul''
A.
Source = ''module/consul''
Answers
B.
Source = ''githhub.comicrop/example''
B.
Source = ''githhub.comicrop/example''
Answers
C.
Source =''[email protected]:hasicrop/example.git''
C.
Source =''[email protected]:hasicrop/example.git''
Answers
D.
Source = ''hasicrop/consul/aws''
D.
Source = ''hasicrop/consul/aws''
Answers
Suggested answer: A

Explanation:

The module source path that does not specify a remote module issource = 'module/consul'. This specifies a local module, which is a module that is stored in a subdirectory of the current working directory. The other options are all examples of remote modules, which are modules that are stored outside of the current working directory and can be accessed by various protocols, such as Git, HTTP, or the Terraform Registry. Remote modules are useful for sharing and reusing code across different configurations and environments.Reference= [Module Sources], [Local Paths], [Terraform Registry], [Generic Git Repository], [GitHub]

Terraform configuration (including any module references) can contain only one Terraform provider type.

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: B

Explanation:

Terraform configuration (including any module references) can contain more than one Terraform provider type. Terraform providers are plugins that Terraform uses to interact with various cloud services and other APIs. A Terraform configuration can use multiple providers to manage resources across different platforms and services. For example, a configuration can use the AWS provider to create a virtual machine, the Cloudflare provider to manage DNS records, and the GitHub provider to create a repository. Terraform supports hundreds of providers for different use cases and scenarios.Reference= [Providers], [Provider Requirements], [Provider Configuration]

You have declared a variable called var.list which is a list of objects that all have an attribute id . Which options will produce a list of the IDs? Choose two correct answers.

A.
[ var.list [ * ] , id ]
A.
[ var.list [ * ] , id ]
Answers
B.
[ for o in var.list : o.Id ]
B.
[ for o in var.list : o.Id ]
Answers
C.
var.list[*].id
C.
var.list[*].id
Answers
D.
{ for o in var.llst : o => o.id }
D.
{ for o in var.llst : o => o.id }
Answers
Suggested answer: B, C

Explanation:

These are two ways to produce a list of the IDs from a list of objects that have an attributeid, using either a for expression or a splat expression syntax.

What does the default 'local' Terraform backend store?

A.
tfplan files
A.
tfplan files
Answers
B.
State file
B.
State file
Answers
C.
Provider plugins
C.
Provider plugins
Answers
D.
Terraform binary
D.
Terraform binary
Answers
Suggested answer: B

Explanation:

The default ''local'' Terraform backend stores the state file in a local file named terraform.tfstate, which can be used to track and manage the state of your infrastructure3.

Which of these commands makes your code more human readable?

A.
Terraform validate
A.
Terraform validate
Answers
B.
Terraform output
B.
Terraform output
Answers
C.
Terraform show
C.
Terraform show
Answers
D.
Terraform fmt
D.
Terraform fmt
Answers
Suggested answer: D

Explanation:

The command that makes your code more human readable isterraform fmt. This command is used to rewrite Terraform configuration files to a canonical format and style, following the Terraform language style conventions and other minor adjustments for readability. The command is optional, opinionated, and has no customization options, but it is recommended to ensure consistency of style across different Terraform codebases. Consistency can help your team understand the code more quickly and easily, making the use ofterraform fmtvery important. You can run this command on your configuration files before committing them to source control or as part of your CI/CD pipeline.Reference= :Command: fmt:Using Terraform fmt Command to Format Your Terraform Code

Any user can publish modules to the public Terraform Module Registry.

A.
True
A.
True
Answers
B.
False
B.
False
Answers
Suggested answer: A

Explanation:

The Terraform Registry allows any user to publish and share modules. Published modules support versioning, automatically generate documentation, allow browsing version histories, show examples and READMEs, and more. Public modules are managed via Git and GitHub, and publishing a module takes only a few minutes.Once a module is published, releasing a new version of a module is as simple as pushing a properly formed Git tag1.

Reference= The information can be verified from the Terraform Registry documentation on Publishing Modules provided by HashiCorp Developer1.

Total 195 questions
Go to page: of 20