2
votes

I'm just beginning terraform. Fortunately, I got a basic azure deployment of a resource group working.

But there is one "parameter" or attribute or something that I do not know what it means.

https://www.terraform.io/docs/providers/azurerm/r/resource_group.html

In the "basic" example for an azure resource group (although the question is not applies to more than just an azure-resoure-group), the syntax looks like this:

resource "azurerm_resource_group" "test" {
  name     = "testResourceGroup1"
  location = "West US"

  tags {
    environment = "Production"
  }
}

So I totally understand "name", "location", tags.

And I understand "azurerm_resource_group"..which drives the functionality.

What is the "test" value? It seems like it can be anything.

Other items have it:

https://www.terraform.io/docs/providers/azurerm/r/function_app.html

Again the same "test" value.

What is that thing??

1

1 Answers

3
votes

That's the name you're giving your resource in the Terraform scripts - it allows you to reference it elsewhere in the script.

For example, if you want to use the id attribute that's exported from that resource elsewhere in your script, you would use:

somethingelse =    "${azurerm_resource_group.test.id}"
                                          #   ^ name used here