|
Szenario
|
Zustandsstatus
|
Soll der vorherige Zustand wiederhergestellt werden?
|
Richtiger Wiederherstellungsansatz
|
|---|---|---|---|
|
Terraform "apply" schlägt vollständig fehl. Es werden keine Ressourcen erstellt.
|
Zustand unverändert
|
Nein
|
Code zurücksetzen und Terraform "plan" ausführen.
|
|
"Apply" ist teilweise erfolgreich, in diesem Fall werden einige Ressourcen erstellt.
|
Zustand teilweise aktualisiert, aber zutreffend
|
Nein
|
Code zurücksetzen und Terraform "apply" erneut ausführen.
|
|
"Apply" stürzt während des Zustands-Schreibvorgangs ab.
|
Zustand beschädigt oder unlesbar
|
Ja
|
Vorherige Blob-Version wiederherstellen, und Terraform erneut ausführen.
|
|
"Apply" erfolgreich, Bereitstellung muss jedoch rückgängig gemacht werden.
|
Zustand gültig
|
Nein
|
Code zurücksetzen und Terraform "apply" erneut ausführen.
|
|
Komponente
|
Status
|
|---|---|
|
Code
|
Enthält neue Ressource
|
|
Zustand
|
Unverändert
|
|
Azure
|
Keine Ressource erstellt
|
Code: gpt-5-nano deployment added
State: V1 (unchanged)
Azure: resource does not exist
#if using git...
git checkout <earlier_branch/earlier_tag>
terraform plan -var-file=infra.tfvars
|
Komponente
|
Status
|
|---|---|
|
Code
|
Enthält resource1, resource2, resource3
|
|
Zustand
|
Enthält resource1 und resource2
|
|
Azure
|
resource1 und resource2 sind vorhanden, resource3 wurde nicht erstellt
|
Code: resource1, resource2, resource3
State: resource1, resource2
Azure: resource1, resource2
terraform apply -var-file=infra.tfvars
|
Komponente
|
Status
|
|---|---|
|
Zustand
|
resource1, resource2, resource3
|
|
Azure
|
resource1, resource2, resource3
|
#if using git...
git checkout <earlier_branch/earlier_tag>
terraform apply -var-file=infra.tfvars
|
Komponente
|
Status
|
|---|---|
|
Code
|
resource1 und resource2 entfernt
|
|
Zustand
|
resource1 und resource2 vorhanden
|
|
Azure
|
resource1 und resource2 vorhanden
|
- destroy resource1
- destroy resource2
|
Komponente
|
Status
|
|---|---|
|
Zustand
|
bereinigt
|
|
Azure
|
resource1 und resource2 entfernt
|
|
Komponente
|
Status
|
|---|---|
|
Code
|
Kann neue Ressourcen enthalten
|
|
Zustand
|
Beschädigt oder unlesbar
|
|
Azure
|
Ressourcen können vorhanden sein oder nicht
|
terraform plan -var-file=infra.tfvars
╷
│ Error: Unsupported state file format
│
│ The version in the state file is string. A positive whole number is required.
╵
╷
│ Error: Unsupported state file format
│
│ The state file does not have a "version" attribute, which is required to identify the format version.
OR
$ terraform plan -var-file=infra.tfvars
│ Error: Unsupported state file format
│
│ The state file could not be parsed as JSON: syntax error at
│ byte offset 7805.
terraform plan -var-file=infra.tfvars
╷
│ Error: Unsupported state file format
│
│ The version in the state file is string. A positive whole number is required.
╵
╷
│ Error: Unsupported state file format
│
│ The state file does not have a "version" attribute, which is required to identify the format version.
OR
$ terraform plan -var-file=infra.tfvars
│ Error: Unsupported state file format
│
│ The state file could not be parsed as JSON: syntax error at
│ byte offset 7805.
az storage blob list \
--container-name <container_name>\
--account-name <storage_account_name> \
--include v \
--auth-mode login \
--query "[?name=='terraform.tfstate'].{name:name, Version:versionId, Modified:properties.lastModified}" \
--output table
|
Name
|
Version
|
Modified
|
|---|---|---|
|
terraform.tfstate
|
2026-03-13T11:00:00.0000000Z
|
2026-03-13T11:00:00
|
|
terraform.tfstate
|
2026-03-13T11:05:00.0000000Z
|
2026-03-13T11:05:00
|
az storage blob download \
--container-name <container_name> \
--account-name <storage_account_name> \
--name terraform.tfstate \
--version-id <version_id> \
--file recovered-state.json \
--auth-mode login
az storage blob upload \
--container-name <container_name> \
--account-name <storage_account_name> \
--name terraform.tfstate \
--file recovered-state.json \
--overwrite \
--auth-mode login
az storage blob list \
--container-name <container_name>\
--account-name <storage_account_name> \
--include v \
--auth-mode login \
--query "[?name=='terraform.tfstate'].{name:name, Version:versionId, Modified:properties.lastModified}" \
--output table
|
Version
|
Beschreibung
|
|---|---|
|
V1
|
Ursprünglich gültiger Zustand
|
|
V2
|
Beschädigter Zustand
|
|
V3
|
Gültiger Zustand wiederhergestellt
|
|
Testschritt
|
Erwartetes Ergebnis
|
|---|---|
|
Beschädigte Zustandsdatei
|
Terraform kann Zustand nicht lesen
|
|
Blob-Versionen prüfen
|
Vorherige Zustandsversion vorhanden
|
|
Gültige Version herunterladen
|
Gültiger JSON-Zustand abgerufen
|
|
Zustandsdatei wiederherstellen
|
Blob erfolgreich ersetzt
|
|
Terraform "plan" ausführen
|
Terraform voll funktionsfähig
|
|
Komponente
|
Status
|
|---|---|
|
Code
|
Enthält gpt-5-nano
|
|
Zustand
|
Enthält gpt-5-nano
|
|
Azure
|
gpt-5-nano vorhanden
|
#if using git...
git checkout <earlier_branch/earlier_tag>
terraform apply -var-file=infra.tfvars
│Error: Error acquiring the state lock
│ Error message: state blob is already locked
│ Lock Info:
│ ID: 47befb15-5e0e-908e-d1cd-298e3c723f3d
│ Path: tfstate/infra.tfstate
│ Operation: OperationTypePlan
│ Who: user@machine
│ Version: 1.14.0
│ Created: 2026-04-09 07:02:45 +0000 UTC
az storage blob lease break \
--account-name "<storage-account>" \
--container-name "<container>" \
--blob-name "<state-file>.tfstate" \
--auth-mode login
│ Error: creating Private Endpoint: Put "https://management.azure.com/...":
│ net/http: TLS handshake timeout
│ Error: creating AKS Cluster: HTTP response was nil; connection may have been reset
│ Error: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
$env:ARM_CLIENT_TIMEOUT_SECONDS = "3600"
terraform apply -var-file="infra.tfvars"
│ Error: a resource with the ID "/subscriptions/xxx/resourceGroups/my-rg/providers/
│ Microsoft.ContainerService/managedClusters/my-cluster" already exists - to be
│ managed via Terraform this resource needs to be imported into the State.
│
│ with module.aks.azurerm_kubernetes_cluster.aks,
│ on ../../modules/aks/main.tf line 13, in resource "azurerm_kubernetes_cluster" "aks":
│ 13: resource "azurerm_kubernetes_cluster" "aks" {
terraform import -var-file="infra.tfvars" \
"module.aks.azurerm_kubernetes_cluster.aks" \
"/subscriptions/xxx/resourceGroups/my-rg/providers/Microsoft.ContainerService/managedClusters/my-cluster"
│ Error: creating Deployment: unexpected status 400 (400 Bad Request) with error:
│ InsufficientQuota: This operation require 10000 new capacity in quota
│ One Thousand Tokens Per Minute - gpt-5-mini - DataZoneStandard, which is bigger
│ than the current available capacity 3650. The current quota usage is 350 and
│ the quota limit is 4000.
{"error": {"code": "403", "message": "Traffic is not from an approved private endpoint."}}
az network private-endpoint show \
--resource-group "<rg>" \
--name "<pe-name>" \
--query "privateLinkServiceConnections[0].privateLinkServiceConnectionState.status"
kubectl run dns-test --image=busybox --rm -it --restart=Never -- \
nslookup <account-name>.openai.azure.com
│ Error: deleting Deployment: unexpected status 409 (Conflict) with error:
│ DeploymentInUse: The deployment 'gpt-5-mini-2025-08-07-spillover' cannot be
│ deleted because it is referenced by deployment 'gpt-5-mini-2025-08-07' as
│ spillover deployment.
terraform destroy \
-target="module.cognitive_deployment-gpt5-mini.azapi_resource.deployment_with_spillover[0]" \
-var-file="infra.tfvars"
│ Error: building AzureRM Client: obtain subscription() from Azure CLI:
│ parsing json result from the Azure CLI: waiting for the Azure CLI:
│ exit status 1: ERROR: Please run 'az login' to setup account.
│ Error: obtaining Authorization Token: AADSTS700024: Client assertion is not
│ within its valid time range.
│ Error: Subscription not found: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
│ Error: deleting Resource Group: the Resource Group was not found
│
│ Resource Group Name: "my-rg"