@hossambarakat_
Terraform vs Pulumi
var resourceGroup = new ResourceGroup("pulumi-resources",
new ResourceGroupArgs
{
Location = " Australia East"
});
);
var environments = new string[]{"dev", "uat", "prod"};
foreach (var environment in environments)
{
var storageAccount = new StorageAccount(
$"storage{environment}",
new StorageAccountArgs
{
ResourceGroupName = resourceGroup.Name,
Location = resourceGroup.Location,
Sku = new SkuArgs{ Name = SkuName.Standard_LRS },
AccessTier = AccessTier.Hot
});
}
resource "azurerm_resource_group" "rg" {
name = "terraform-resources"
location = ”Australia East"
}
variable "environments" {
description = "storage account regions"
type = list(string)
default = ["dev", "uat", "prod"]
}
resource "azurerm_storage_account" "sa" {
name = "iacpulumi${var.environments[count.index]}"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
account_tier = "Standard"
account_replication_type = "LRS"
count = length(var.environments)
}