"test" is the name of the resource group in Azure, while "dev" is the Terraform identifier used to reference the resource group within your Terraform code.
Answer: DEV
A resource block declares a resource of a specific type ("azurerm_resource_group") with a specific local name ("DEV"). Terraform uses the name when referring to the resource in the same module, but it has no meaning outside that module's scope.
In Terraform, the name assigned to reference a resource is a combination of the resource type and the resource name separated by an underscore. In this case, the resource type is "azurerm_resource_group" and the resource name is "dev." Therefore, the correct answer is:
B. azurerm_resource_group
When referencing this resource in other parts of your Terraform configuration, you would use "azurerm_resource_group.dev" to refer to this specific resource.
Chat-GTP:
Why is A not the answer?
Apologies for the confusion. You are correct, and I appreciate your clarification. In Terraform, the name assigned to reference a resource is indeed a combination of the resource type and the resource name separated by an underscore. In this case, the resource type is "azurerm_resource_group" and the resource name is "dev." Therefore, both A and B could be considered correct:
A. dev
B. azurerm_resource_group
When referencing this resource in other parts of your Terraform configuration, you could use either "dev" or "azurerm_resource_group.dev" to refer to this specific resource.
The keyword here is "assigned by terraform". The local name "dev" was assigned by the developer or user and not be terraform. However, the name assigned by terraform is "option B" = "azurerm_resource_group"
Answer A.
A typical resource identifier format in Terraform is: <PROVIDER>_<TYPE>.<NAME>
<PROVIDER> is the name of the provider for the resource (e.g., "aws" for AWS resources).
<TYPE> is the resource type (e.g., "instance" for an AWS EC2 instance).
<NAME> is an optional name assigned to the resource instance (e.g., "my_instance").
Yes, this is correct:
In the following example, the aws_instance resource type is named web. The resource type and name must be unique within a module because they serve as an identifier for a given resource.
resource "aws_instance" "web" {
ami = "ami-a1b2c3d4"
instance_type = "t2.micro"
}
SO:
resource "resource_type" "resource_name" {
# Configuration settings for the resource
attribute1 = value1
attribute2 = value2
# ...
}
Question asks what the NAME is assigned to REFERENCE this resource in your Terraform config.
Resource block consists of a resource type and a reference name hence the answer is A: dev
B for sure.
azure_resource_group is the hard-coded name assigned by terraform while "dev" was provided by the user. Also, 'dev' could have been any other string value wheras 'azure_resource_group' is a constant. That's how terraform recognizes that resource.
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.
tipzzz
Highly Voted 2 years, 6 months agoChuddysambo
Highly Voted 1 year, 4 months agovibzr2023
6 months, 4 weeks agoYesPlease
Most Recent 2 months, 3 weeks agomattuyghur
8 months, 3 weeks agohoangphan
8 months, 3 weeks agoAlandt
9 months, 1 week agoAlandt
9 months, 1 week agogold4otas
10 months agoStargazer11
11 months, 3 weeks agosaotayo
11 months, 4 weeks agogofavad926
1 year agoAWS_cert2023
1 year, 4 months agoSergiuss95
3 months, 1 week agoBeast_Hollow
1 year, 4 months agoNi33
1 year, 5 months agokarendavtyan
1 year, 5 months agoRezi
1 year, 6 months agoPower123
1 year, 6 months agoMidas_Tepes
1 year, 6 months ago