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 <74574173+karishma-chawla@users.noreply.github.com>
  • Loading branch information
kachawla committed Feb 1, 2024
1 parent c1a8d16 commit 0a5c1e0
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 = "account-${random_id.unique_name.id}"
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 = "container-${random_id.unique_name.id}"
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.id}"
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 0a5c1e0

Please sign in to comment.