1 / 10 Terraform Professional 002 Exam Terraform Infrastructure Engineer Professional 002 https://www.passquestion.com/terraform-professional- 002.html 35% OFF on All, Including Terraform Professional 002 Questions and Answers P ass Terraform Professional 002 Exam with PassQuestion Terraform Professional 002 questions and answers in the first attempt. https://www.passquestion.com/ 2 / 10 1.A network team retains exclusive lifecycle ownership of an existing network and its subnets. It publishes their IDs through an approved configuration input channel. An application team must create, update, and retire service compute instances, and those instances must use the published subnets. Which division of Terraform configuration responsibilities meets this contract? A. Declare managed resources for the network, subnets, and service instances; import the existing network and subnets into application state. B. Receive the network and subnet IDs as input variables, and represent the service instances with data sources. C. Receive the network and subnet IDs as input variables, and declare managed resources for the service instances. D. Create an application-owned network and subnets with managed resources, and declare managed service instances in those new subnets. Answer: C Explanation: The application configuration must manage the service instances while consuming identifiers for networking owned elsewhere. Input variables can carry the published network and subnet IDs into the managed service resources. Importing the existing networking would associate it with managed resource addresses in application state, exceeding the ownership contract even though it would avoid creating another network. A - Incorrect: Importing existing networking adopts it into the application's managed resources. The network team's exclusive lifecycle ownership rules out that responsibility. B - Incorrect: Input variables appropriately carry the external network identifiers, but data sources read existing service instances. They do not implement the application's responsibility to create, update, and retire those instances. C - Correct: The inputs identify the approved external networking, while managed service resources implement the lifecycle responsibilities assigned to the application team. D - Incorrect: Creating separate networking changes the deployment destination. The contract requires service instances to use the existing published subnets. 2.The Orders and Billing teams deploy separate services using HCP Terraform. The organization supports workspace-level team permissions, and neither team has broader access grants. Each service module accepts network and subnet IDs and exposes both a logical service HTTPS URL and backend instance IP addresses. The design must meet these business requirements: Which complete configuration design meets all requirements? A. Use a separate root and HCP Terraform workspace for each service; pass the published network IDs 3 / 10 to its service module, forward its HTTPS URL as a root output, and configure service-specific credentials and apply permissions limited to its owning team. B. Use one root and HCP Terraform workspace containing both service modules; pass the published network IDs to both modules, forward both HTTPS URLs as root outputs, and use credentials for both services with both teams granted apply permission on the workspace. C. Use a separate root and HCP Terraform workspace for each service; manage the shared network and subnets in those roots, pass their resource IDs to each service module, forward its HTTPS URL as a root output, and configure service-specific credentials and apply permissions. D. Use a separate root and HCP Terraform workspace for each service; pass the published network IDs to its service module, publish its backend instance IP addresses as root outputs, and configure service- specific credentials and apply permissions limited to its owning team. Answer: A Explanation: The complete design must satisfy ownership, consumer access to service information, and deployment authority together. Each service configuration can consume the published network IDs and expose its module's logical service URL through a root output. Separate HCP Terraform workspaces, service- specific credentials, and effective apply permissions limited to the owning team provide the required delegation. A shared workspace can contain both modules and their outputs, but granting both teams apply permission on it gives both teams authority over the shared configuration. A - Correct: Consuming network IDs preserves external ownership. Forwarding each module's HTTPS URL supplies the consumer interface. Separate workspaces with scoped credentials and apply permissions satisfy independent deployment authority. B - Incorrect: The network consumption and URL outputs meet their requirements, but both teams can apply the workspace containing both services. Shared run credentials also fail the requirement for credentials scoped to each service. C - Incorrect: The service outputs and deployment delegation are appropriate, but managing the shared network in the service roots assigns network lifecycle responsibility to those configurations. D - Incorrect: The ownership and authority boundaries are appropriate, but backend instance addresses expose replaceable members of the service. They do not provide the logical HTTPS URL required by the webhook client. 3.You are publishing a reusable Terraform service module. Each caller supplies a service name and requested replica count. The module maintainers choose the compute and load balancer implementations and may change their provider resource types in later compatible releases. Monitoring consumers need the logical service's HTTPS URL, and their configuration must remain independent of those internal resource choices. Which input/output contract meets these requirements? A. Accept service_name and replicas as input variables; return the current load balancer resource object, with callers deriving the HTTPS URL from its attributes. B. Accept service_name and replicas as input variables; return backend instance IDs, with callers looking up their addresses to construct the monitoring target. C. Require service_name, replicas, and settings for the chosen compute and load balancer resource types as input variables; return a service_url string containing the HTTPS URL. D. Accept service_name and replicas as input variables; return a service_url string containing the 4 / 10 complete HTTPS URL for the logical service. Answer: D Explanation: The service name and requested replica count are caller-controlled choices, so they belong in the module's input interface. Monitoring needs the logical service's complete HTTPS URL, so the module should expose that value directly. The module can derive the URL from its current resources while preserving the output's meaning. Returning the whole load balancer object could provide enough information to construct a URL today, but it makes consumers depend on provider-specific attributes that the maintainers may change. A - Incorrect: The inputs match the caller's choices, but returning the current load balancer resource object requires consumers to understand its attributes and construct the URL. That exposes the implementation through the output contract. B - Incorrect: Backend instance IDs identify internal service members. Looking up their addresses makes monitoring depend on replaceable compute resources instead of the logical service endpoint. C - Incorrect: The URL output meets the monitoring need, but requiring settings for the chosen compute and load balancer resource types makes callers participate in implementation choices assigned to the module maintainers. D - Correct: The inputs represent the caller-controlled service choices, and the string output provides the connection value monitoring needs without exposing internal resource attributes. 4.A Terraform 1.15 root module will create a subnet and an application service in one apply. The service must attach to that subnet. The subnet resource exposes a provider-generated id that is unknown before creation, and the service accepts this ID through its subnet_id argument. The resource blocks are in network.tf and service.tf. Which design supplies the required value and establishes the service's dependency on the subnet? A. Set the service's subnet_id argument to a reference to the subnet resource's id attribute. B. Set the service's subnet_id argument from a root input variable and add depends_on referencing the subnet resource. C. Set the service's subnet_id argument from a root input variable and rename the files to 01-network.tf and 02-service.tf. D. Set the service's subnet_id argument from a root input variable and place the subnet block before the service block in main.tf. Answer: A Explanation: Referencing the subnet resource's id in the service's subnet_id argument supplies the provider- generated value and establishes an implicit dependency. Terraform can track this relationship while the ID is still unknown. Explicit depends_on establishes ordering but does not assign the subnet ID to an input variable. Filenames and block positions do not determine resource creation order. These relationships follow the documented [resource composition] (https://developer.hashicorp.com/terraform/language/v1.15.x/modules/develop/composition) and [resource-order rules] (https://developer.hashicorp.com/terraform/language/v1.15.x/style). A - Correct: The reference connects the service argument to the ID produced by the subnet resource. It also gives Terraform the dependency needed to create the subnet before creating the service. B - Incorrect: Explicit depends_on makes the service wait for the subnet, but it does not populate the root 5 / 10 input variable with the subnet's newly generated ID. Ordering alone does not supply the required value. C - Incorrect: Numeric filename prefixes can organize configuration for readers, but they do not establish resource execution order. The root input variable also lacks a connection to the newly generated subnet ID. D - Incorrect: Putting the subnet block first improves readability but does not establish a dependency. The separately supplied input variable does not automatically receive the subnet resource's ID. 5.A production service must remain available throughout a replacement triggered by a provider argument change. An engineer adds create_before_destroy = true, and terraform validate succeeds. The platform requires unique names for live service instances, the account has an instance quota, and clients use a separately managed routing entry. Only the validation result has been checked. What additional evidence is needed to establish the feasibility of meeting the availability requirement? A. A plan showing creation before destruction, treating that ordering as sufficient evidence for naming, quota, and routing feasibility. B. Confirmation that names and quota permit both instances to coexist, with the routing entry switched after the current instance is removed. C. Confirmation that routing can switch before removal, treating successful validation as evidence that names and quota permit coexistence. D. Confirmation that names and quota permit both instances to coexist and that routing can switch to a healthy replacement before the current instance is removed. Answer: D Explanation: The availability requirement needs both successful coexistence and uninterrupted client access during replacement. create_before_destroy changes replacement order, but concurrent objects must still satisfy naming and capacity constraints, and traffic must reach a healthy replacement before the current instance is removed. A plan showing that order does not establish all of those conditions. The [lifecycle reference] (https://developer.hashicorp.com/terraform/language/v1.15.x/meta-arguments/lifecycle) documents the coexistence constraints, while the [validate reference] (https://developer.hashicorp.com/terraform/cli/v1.15.x/commands/validate) explains that validation does not check remote services or provider APIs. A - Incorrect: The plan can show the requested replacement order, but that order alone does not establish compatible concurrent names, spare quota, or a working traffic transition. B - Incorrect: Naming and quota checks establish whether both instances can coexist. Switching routing only after removing the current instance leaves clients without the required continuous access during the transition. C - Incorrect: A traffic switch before removal addresses client access, but successful validation does not establish whether the platform permits the proposed names or whether the account has sufficient quota. D - Correct: This evidence addresses all stated feasibility gaps: permitted concurrent names, capacity for both instances, and client traffic reaching a healthy replacement before the current instance is removed. 6.A reviewer receives a Terraform 1.15 root module change. terraform fmt completed without modifying the submitted .tf files, and terraform validate succeeded after the referenced modules and providers were installed. No plan is included. Staging and production use the same configuration revision but different input values and state. 6 / 10 Which assessment correctly describes the completed checks and the evidence needed to review proposed production changes? A. fmt checks formatting and value types; validate checks internal consistency; a production plan is needed to review the proposed changes. B. fmt checks formatting; validate checks syntactic validity and internal consistency; a plan using production inputs and state is needed to review the proposed changes. C. fmt checks formatting; validate checks consistency with production state; a production plan is needed to review the ordering of the identified changes. D. fmt checks formatting; validate checks syntactic validity and internal consistency; a staging plan of the same revision is sufficient to review the proposed production changes. Answer: B Explanation: The successful formatting check supports consistent formatting of the submitted files. Initialized validation supports syntactic validity and internal consistency, including attribute and type checks, but does not inspect remote state or provider APIs. Reviewing proposed production changes requires a plan using production inputs and state. A staging plan could be valid for staging while proposing different actions because the environments have different inputs and state. Planning previews changes without applying them. A - Incorrect: This attributes value-type checking to the formatter. Formatting does not establish semantic correctness; type checks belong to validation. The need for a production plan is appropriate. B - Correct: This assigns the proper assurance to each check and requests the missing environment- specific evidence. Production inputs and state are needed to determine the proposed production changes. C - Incorrect: Validation checks local configuration consistency, not consistency with production state. Its success does not identify production changes whose ordering alone remains to be reviewed. D - Incorrect: A shared configuration revision does not make a staging plan sufficient for production. Different input values and state can produce different planned actions. 7.A team uses Terraform 1.15. Its root module requires hashicorp/random with the version constraint >= 3.6.0, < 4.0.0. A proposed .terraform.lock.hcl change selects 3.6.2 instead of 3.6.0 and updates the package hashes. The team has reviewed and approved this change, and 3.6.2 satisfies every module's provider constraints. The team will retain the configured range for future reviewed updates. Which workflow keeps developer checkouts and fresh CI jobs selecting 3.6.2 until the next approved update, even if newer releases satisfy the same configured constraints? A. Commit the approved updated lockfile and use terraform init -upgrade for routine initialization. B. Exclude the lockfile from version control and use ordinary terraform init for routine initialization. C. Commit the approved updated lockfile and use ordinary terraform init for routine initialization. D. Commit the previous lockfile after changing its constraints entry to = 3.6.2, and use ordinary terraform init for routine initialization. Answer: C Explanation: The configured range permits multiple provider versions, while the lockfile records a specific selection and its package hashes. Committing the approved lockfile and using ordinary terraform init keeps 7 / 10 developer checkouts and fresh CI jobs selecting 3.6.2 because it satisfies all configured constraints. Committing the same lockfile but routinely using terraform init -upgrade would allow a newer matching version to replace that selection. Reserve provider reselection for an intentional update whose lockfile changes receive review. A - Incorrect: The upgrade flag disregards existing locked selections and chooses the newest version allowed by the configuration. Committing the updated lockfile does not prevent routine initialization with this flag from selecting a later compatible release. B - Incorrect: Without a shared lockfile, a fresh checkout selects the newest available provider version matching the configured range. The range alone cannot keep all subsequent initializations selecting the approved 3.6.2 release. C - Correct: The approved lockfile records version 3.6.2 and its package hashes. Version control shares that selection, and ordinary initialization reuses it because it satisfies every module's provider constraints. D - Incorrect: The lockfile's constraints entry documents the constraints considered during selection; Terraform does not use that entry to make installation decisions. Editing it does not replace the previous version selection, so ordinary initialization still selects 3.6.0. 8.An infrastructure engineer reviews a change before production promotion using Terraform 1.15. Fresh runners must use the same provider and module releases that were reviewed, and credential handling must be approved for version control and run artifacts. The reviewed releases are hashicorp/aws 5.100.0 and version 2.3.1 of an internal Registry module. Source and package trust checks are complete. The unchanged provider constraint is ~> 5.0. The committed .terraform.lock.hcl selects hashicorp/aws 5.100.0 with verified package checksums; its version and hashes are unchanged. The following is the complete diff. The existing S3 backend will receive prod.backend.hcl during initialization. Credential strings shown here are redacted for display; the commit contains active values. Code (diff) --- a/main.tf +++ b/main.tf @@ -1,4 +1,4 @@ module "service" { source = "registry.example.com/platform/service/aws" - version = "2.3.1" + version = ">= 2.3.1, < 3.0.0" } --- /dev/null +++ b/prod.backend.hcl @@ -0,0 +1,6 @@ +bucket = "example-prod-state" +key = "service/terraform.tfstate" +region = "us-east-1" +encrypt = true +access_key = "<redacted-active-access-key>" +secret_key = "<redacted-active-secret-key>" 8 / 10 Later matching module releases may be published before a fresh runner initializes. Which review conclusion correctly identifies the evidence still needed before promotion? A. Accept dependency reproducibility from the committed lockfile; require evidence that backend credentials are kept out of version control and sensitive artifacts have restricted readers. B. Require the exact reviewed module version while retaining the provider lockfile; accept backend credential handling on the evidence that remote state is encrypted. C. Require the exact reviewed module version while retaining the provider lockfile; require evidence that backend credentials are kept out of version control and sensitive artifacts have restricted readers. D. Accept dependency reproducibility from the committed lockfile; accept backend credential handling on the evidence that remote state is encrypted. Answer: C Explanation: The unchanged lockfile establishes the reviewed provider selection and package checksums. It does not record remote module selections, so the broadened module constraint can select a release other than the reviewed 2.3.1 on a fresh runner. Restoring the exact reviewed module version meets the stated reproducibility requirement. The active credentials added to version control require separate security evidence: encrypted remote state does not protect credentials committed in another location. Promotion therefore requires evidence for both repeatable module selection and approved credential handling, including access controls for sensitive artifacts. Requesting credential evidence alone addresses the exposure but leaves module reproducibility unresolved. A - Incorrect: Requesting credential-handling evidence addresses the security concern, but the provider lockfile does not fix the selected remote module version. The broadened module constraint still permits a different release on a fresh runner. B - Incorrect: An exact reviewed module version addresses reproducibility. Remote-state encryption protects stored state, however, and does not protect active credentials added to version control or establish appropriate protection for other sensitive artifacts. C - Correct: Both evidence gaps are identified. The provider lockfile already records the reviewed provider selection; the remote module needs an exact reviewed version, and the committed credentials need approved handling and protection for sensitive artifacts. D - Incorrect: This conclusion extends the provider lockfile's coverage to remote modules and extends remote-state encryption's protection to committed credentials. Neither extension is supported, so both promotion requirements remain unresolved. 9.A Terraform 1.15 root module keeps its resource, variable, and output blocks in service.tf. It has no main.tf, variables.tf, or outputs.tf. The declarations are otherwise valid, and the team has no mandatory file-layout convention. During review, someone raises a syntax concern because the layout differs from HashiCorp's style guide. Which decision is appropriate? A. Require a main.tf file for resource declarations before accepting the configuration as valid. B. Accept the layout as valid Terraform and suggest splitting declarations if it improves readability. C. Require variables.tf and outputs.tf for their respective declarations before accepting the configuration as valid. D. Require separate .tf files for each top-level block type before accepting the configuration as valid. Answer: B 9 / 10 Explanation: HashiCorp's file-layout guidance supports readability and maintenance; the conventional filenames are not syntax requirements. Resource, variable, and output blocks may share service.tf. Because the declarations are otherwise valid and no team convention requires a split, accepting the layout is appropriate. Requiring main.tf would mistake a conventional filename for a mandatory entry point. A - Incorrect: main.tf is a conventional location for resource declarations, not a required entry point. Its absence does not make the configuration invalid. B - Correct: The guide recommends filenames to help maintainers navigate the code. With otherwise valid declarations and no mandatory team layout, splitting service.tf is a readability choice. C - Incorrect: variables.tf and outputs.tf are recommended organizational names. Variable and output blocks do not require those filenames to be valid. D - Incorrect: Terraform does not require an ordinary .tf file to contain only one top-level block type. Separating block types can improve navigation without changing syntax validity. 10.Each CI build starts in a fresh working directory using Terraform 1.15. The team requires routine builds to reuse reviewed provider selections, with intentional upgrades handled in separate dependency reviews. The committed .terraform.lock.hcl selections still satisfy the configured ranges; newer matching provider releases are available. A proposal changes every build to terraform init -upgrade and automatically commits the resulting lockfile. The same proposal adds a third-party provider whose checksums are signed by a publisher the team has not evaluated. New provider sources also require a trust review. Which replacement workflow satisfies these requirements? A. Keep routine terraform init -upgrade with the committed lockfile, reserve dependency review for scheduled updates, and explicitly review trust in the new signer. B. Use routine terraform init with a reviewed, committed lockfile, reserve terraform init -upgrade for reviewed updates, and accept the new signer based on its signed checksums alone. C. Use routine terraform init with a reviewed, committed lockfile, reserve terraform init -upgrade for reviewed updates, and explicitly review trust in the new signer. D. Use routine terraform init without a version-controlled lockfile, reserve terraform init -upgrade for reviewed updates, and explicitly review trust in the new signer. Answer: C Explanation: Because the locked provider versions still satisfy the configured ranges, ordinary terraform init reuses those selections. terraform init -upgrade disregards previous selections and chooses the newest matching versions, so it belongs in separately reviewed dependency updates. Signed checksums support package verification but do not establish the team's trust in their signer. Using a reviewed, committed lockfile for routine builds and explicitly reviewing the new signer satisfies both obligations. Fixing version reuse while accepting the signer from its signature alone leaves source trust unresolved. A - Incorrect: Routine init -upgrade disregards the committed provider selections even when they satisfy the constraints. With newer matching releases available, it can introduce version changes outside the scheduled dependency review; reviewing the signer does not resolve that problem. B - Incorrect: Ordinary init and separately reviewed upgrades preserve the intended selection workflow. However, a valid checksum signature does not decide whether the team trusts the publisher. Initial source trust still requires review. 10 / 10 C - Correct: Ordinary init reuses compatible selections from the reviewed lockfile. Separate init -upgrade updates allow deliberate review and commitment of new selections, while the signer review addresses the initial trust decision before accepting the new provider. D - Incorrect: Without a version-controlled lockfile, each fresh build has no recorded provider selections to reuse. Ordinary init then selects the newest releases allowed by the ranges, so routine builds can change versions despite the separate upgrade schedule and signer review. 11.An infrastructure engineer reviews this complete provider-free root configuration using Terraform 1.15. The only supplied input value is shown in terraform.tfvars. main.tf: Code (hcl) variable "stage" { type = string default = "dev" } locals { base_name = "payments-${var.stage}" job_name = "${local.base_name}-worker" } output "job_name" { value = local.job_name } terraform.tfvars: Code (hcl) stage = "prod" What string does the root output job_name evaluate to? A. The output evaluates to "payments-dev-worker". B. The output evaluates to "payments-prod". C. The output evaluates to "payments-prod-worker". D. The output evaluates to "prod-worker". Answer: C Explanation: The root assignment sets var.stage to "prod". The base_name local evaluates to "payments-prod", and job_name appends "-worker", producing "payments-prod-worker". The root output returns local.job_name. The variable's default does not determine the result because an input value was supplied. A - Incorrect: This follows the variable's default instead of the supplied root assignment. The input value is "prod", so the locals do not use "dev". B - Incorrect: This is the value of local.base_name. The output references local.job_name, which adds the worker suffix. C - Correct: The supplied stage flows through both local expressions, and the output returns the completed name. D - Incorrect: This drops the literal "payments-" prefix from the base_name expression. That prefix remains part of the value passed into job_name.