Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unique resource names in test Terraform Recipe #7108

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think it might be related to this or test-container above. I don't think it is due to another long-running test deleting it but a functional test that happens to be running at the same time might be deleting one of these.

Copy link
Contributor Author

@kachawla kachawla Feb 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is due to another long-running test deleting it but a functional test that happens to be running at the same time might be deleting one of these.

Interesting. Are we sharing resource groups between functional tests and long running tests?

I think it might be related to this or test-container above.

The failure is due to test-container but I just decided to add uniqueness to all resource names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Are we sharing resource groups between functional tests and long running tests?

No, we are not actually. They all belong to a resource group, right? Can't seem to find out why this is caused for now.

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
Loading