fix(azure): check VM size availability at plan time - #136
Merged
Merged
Conversation
- Add the azapi provider to look up the requested VM size in the Microsoft.Compute/skus API, which azurerm has no data source for. - Fail at plan time with a clear message when the size is not offered in the region, is restricted for the subscription (NotAvailableForSubscription, common on Azure for Students), or is Arm64 (the lab uses an x64 Ubuntu image). - Raise the bootstrap dpkg lock timeout from 120s to 300s to match the AWS and GCP bootstraps. - Document the plan-time messages, x64 size options, Azure for Students region policy and credit errors, and the "resource group already exists" error in TROUBLESHOOTING.md. - Replace the README's external Spot-instance workaround link with the in-repo Azure for Students section. Refs #99
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Missing SKU architecture metadata is mishandled, and several troubleshooting commands may inspect or delete resources in the wrong subscription.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds Azure VM SKU preflight validation and improves deployment troubleshooting.
Changes:
- Queries SKU availability and architecture using AzAPI.
- Extends apt lock timeouts.
- Expands Azure troubleshooting guidance.
| File | Description |
|---|---|
azure/main.tf |
Adds SKU checks and timeout updates. |
azure/README.md |
Links Azure Students guidance. |
TROUBLESHOOTING.md |
Documents Azure deployment failures. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…the target subscription
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #99
Changes
azure/main.tfazapiprovider (Microsoft's,~> 2.13), used only to queryMicrosoft.Compute/skusfor the requested VM size.azurermhas no data source for SKU availability. It authenticates with the sameaz logincredentials.preconditions on the VM, soterraform planfails early with a readable message when the size:NotAvailableForSubscription, the common Azure for StudentsSkuNotAvailablecase),TROUBLESHOOTING.mdazure/README.mdStandard_DC1s_v2, which is no longer listed ineastus,eastus2,westus2, orcentralus.Testing
terraform fmt -checkandterraform validatepass (azurerm 5.x, azapi 2.13.0).Plan-level (non-Student subscription):
Standard_B1s, East US)az_region="East US 2"eastus2)Standard_D1(NotAvailableForSubscriptionon this subscription)Standard_B2pts_v2Standard_NopeFull deploy (release mode,
Standard_B1s, East US):setup.donepresent.ctf_userworks, including with public-key auth disabled on the client.Notes
Standard_D1, which carries the sameNotAvailableForSubscriptionrestriction type.Microsoft.Compute/skusand adds a few seconds for the lookup.