From 508e442ba158726b9b8237feced588b89bab0480 Mon Sep 17 00:00:00 2001 From: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:07:04 -0800 Subject: [PATCH] Use unique resource names in Terraform recipe Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com> --- .../corerp-resources-terraform-azurestorage.bicep | 1 - .../test-terraform-recipes/azure-storage/main.tf | 10 +++++++--- .../test-terraform-recipes/azure-storage/variables.tf | 4 ---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep b/test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep index edd8140e006..e560de76062 100644 --- a/test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep +++ b/test/functional/shared/resources/testdata/corerp-resources-terraform-azurestorage.bicep @@ -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 } diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf b/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf index 7f6e0aeda1f..08c69fb4999 100644 --- a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf +++ b/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/main.tf @@ -7,8 +7,12 @@ 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" @@ -16,12 +20,12 @@ resource "azurerm_storage_account" "test_storage_account" { } 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" diff --git a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf b/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf index a1e8130e1a3..b448fb39f28 100644 --- a/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf +++ b/test/functional/shared/resources/testdata/recipes/test-terraform-recipes/azure-storage/variables.tf @@ -1,7 +1,3 @@ -variable "name" { - type = string -} - variable "resource_group_name" { type = string }