Terraform contd…
Configuring Terraform to work with Azure
- Terraform by default uses Azure CLI Credentials
- Once Azure CLI is installed. Launch Terminal and execute
az login command
- Azure has two providers
Lets create a storage account in Azure
Order of Creation
- In Terraform, Resources are created in parallel unless they are dependent on each other.
- There are two ways of defining dependencies
- intrinsic/implicit
- extrinsic/explicit
Resource name in terraform
- This refers to pointing to a specific resource
type.name
resource "azurerm_resource_group" "base" {
name = "fromtf1"
location = "centralindia"
}
# azurerm_resource_group.base
Explicit Dependency
- Explicit dependecy can be added to a resource by using a meta argument called as
depends_on
resource "azurerm_storage_account" "store" {
name = "fromtfltmay25"
resource_group_name = "fromtf1"
location = "centralindia"
account_tier = "Standard"
account_replication_type = "RAGRS"
# explicit dependency
depends_on = [ azurerm_resource_group.base ]
}
Like this:
Like Loading...