Skip to content

Commit

Permalink
Use unique resource names in test Terraform Recipe (radius-project#7108)
Browse files Browse the repository at this point in the history
# Description

Trying a fix for radius-project#7060.
Resource name uniqueness is tied to resource group right now,
potentially causing concurrency issues.

## Type of change

<!--

Please select **one** of the following options that describes your
change and delete the others. Clearly identifying the type of change you
are making will help us review your PR faster, and is used in authoring
release notes.

If you are making a bug fix or functionality change to Radius and do not
have an associated issue link please create one now.

-->

- This pull request fixes a bug in Radius and has an approved issue
(issue link required).
- This pull request is a minor refactor, code cleanup, test improvement,
or other maintenance task and doesn't change the functionality of Radius
(issue link optional).

<!--

Please update the following to link the associated issue. This is
required for some kinds of changes (see above).

-->

Fixes: radius-project#7060

Signed-off-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com>
Co-authored-by: karishma-chawla <74574173+karishma-chawla@users.noreply.github.com>
  • Loading branch information
2 people authored and willdavsmith committed Mar 4, 2024
1 parent 919ef2b commit 46afa55
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 = "acct${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 46afa55

Please sign in to comment.