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

terraform: Fix random VM image deployment errors #322

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

henrirosten
Copy link
Collaborator

This is an attempt to fix the occasional errors that occur on clean deployments. An example terraform error from a deployment before the changes from this PR below:

│ Error: creating Blob "binary-cache.vhd" (Container "ghaf-infra-vm-images" / Account "imgreleaseeun"): creating storage blob
on Azure: while uploading source file "/nix/store/dvg2fqgxzd116zjhw9c5bbps96bzsfqi-azure-image/disk.vhd": writing page at 
offset 4455006208 for file "/nix/store/dvg2fqgxzd116zjhw9c5bbps96bzsfqi-azure-image/disk.vhd": 
blobs.Client#PutPageUpdate: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned 
an error. Status=403 Code="AuthenticationFailed" Message="Server failed to authenticate the request. Make sure the value of 
Authorization header is formed correctly including the signature.\n
RequestId:faafbdc5-e01e-0024-79b8-40a5e6000000\nTime:2024-11-27T10:37:11.7371065Z"
│
│   with module.binary_cache_image.azurerm_storage_blob.default,
│   on modules/azurerm-nix-vm-image/main.tf line 4, in resource "azurerm_storage_blob" "default":
│    4: resource "azurerm_storage_blob" "default" 

This change adds explicit dependencies, and also applies the workaround suggested in: hashicorp/terraform-provider-azurerm#15609.

With these changes, I was not able to reproduce the failure. Although, given the randomness of the error occurance, it's still possible this doesn't completely fix it.

@henrirosten henrirosten marked this pull request as ready for review December 5, 2024 14:12
@henrirosten henrirosten requested a review from a team December 5, 2024 14:12
flokli
flokli previously approved these changes Dec 5, 2024
@henrirosten
Copy link
Collaborator Author

Added azurerm_image.default dependency to data.external.nix_build

@henrirosten
Copy link
Collaborator Author

Rebased

@henrirosten henrirosten merged commit 3a52328 into tiiuae:main Dec 9, 2024
6 checks passed
@henrirosten henrirosten deleted the fix-tf-apply-error branch December 13, 2024 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants