Exam Terraform-Associate-004 Topic 3 Question 165 Discussion

Actual exam question for HashiCorp's Terraform-Associate-004 exam
Question #: 165
Topic #: 3
The exhibit below shows part of a Terraform configuration you have been asked to update. The name of the Azure Virtual Network should be set to the name of the resource group followed by a dash and the word vnet.
Exhibit:
data " azurerm_resource_group " " example " {
name = var.resource_group_name
}
resource " azurerm_virtual_network " " example " {
name = ______________________
}
Which expression fulfills this requirement?

Suggested Answer: A Vote an answer

Detailed Explanation:
* Rationale for Correct Answer: The resource group is declared as a data source, so its name is referenced with data.azurerm_resource_group.example.name. Appending -vnet creates the required virtual network name. Option A correctly produces a string such as my-resource-group-vnet.
* Analysis of Incorrect Options (Distractors):
* B. Incorrect. concat() is used to concatenate lists, not strings.
* C. Incorrect. join() expects a separator and a list of strings, such as join( " - " , [var.
resource_group_name, " vnet " ]). The syntax shown is invalid.
* D. Incorrect. This references a managed resource named azurerm_resource_group.example, but the exhibit shows a data source named data.azurerm_resource_group.example.
* Key Concept: Referencing data source attributes and using string interpolation/concatenation in Terraform expressions.
Reference: Terraform Objective Domain: Read, Generate, and Modify Configurations

by Morgan at Sep 03, 2026, 05:40 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10