Skip to content

Commit

Permalink
Use unique resource names in Terraform recipe
Browse files Browse the repository at this point in the history
Signed-off-by: karishma-chawla <[email protected]>
  • Loading branch information
kachawla committed Feb 4, 2024
1 parent c1a8d16 commit 508e442
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ resource env 'Applications.Core/environments@2023-10-01-preview' = {
templateKind: 'terraform'
templatePath: '${moduleServer}/azure-storage.zip'
parameters: {
name: 'blob${uniqueString(resourceGroup().id)}'
resource_group_name: resourceGroup().name
location: location
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ terraform {
}
}

resource "random_id" "unique_name" {
byte_length = 8
}

resource "azurerm_storage_account" "test_storage_account" {
name = var.name
name = "act-${random_id.unique_name.hex}"
resource_group_name = var.resource_group_name
location = var.location
account_tier = "Standard"
account_replication_type = "LRS"
}

resource "azurerm_storage_container" "test_container" {
name = "test-container"
name = "ctr-${random_id.unique_name.hex}"
storage_account_name = azurerm_storage_account.test_storage_account.name
}

resource "azurerm_storage_blob" "test_blob" {
name = "test-blob"
name = "blob-${random_id.unique_name.hex}"
storage_account_name = azurerm_storage_account.test_storage_account.name
storage_container_name = azurerm_storage_container.test_container.name
type = "Block"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "name" {
type = string
}

variable "resource_group_name" {
type = string
}
Expand Down

0 comments on commit 508e442

Please sign in to comment.