Create An Output of Azure Storage Account Name With Terraform

In this blog post, we will guide you through the process of creating an output for your Azure storage account using Terraform, making it easier to access and use your storage resources.

Output

To create an output for an Azure storage account name using Terraform, you can use the “output” block in your Terraform configuration file. Here is an example:

resource "azurerm_storage_account" "example" {
name = "examplestorageaccount"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
output "storage_account_name" {
value = azurerm_storage_account.example.name
}

In this example, the azurerm_storage_account resource is being created with the name “examplestorageaccount”.

The output block is then used to create an output variable named “storage_account_name” and assigns the value of the name property of the azurerm_storage_account resource as the value for the output.

You can then use the output value in other parts of your configuration or retrieve it after Terraform is applied using the terraform output command.

Processing…
Success! You're on the list.

Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.