$cdtfstate-rg-azure-openai-20240126
$terraforminit
$terraformstatelist
azurerm_cognitive_account.res-1
azurerm_cognitive_account.res-6
azurerm_cognitive_deployment.res-2
azurerm_cognitive_deployment.res-3
azurerm_resource_group.res-0
azurerm_search_service.res-7
## Display the current state of Azure OpenAI resource#$terraformstateshowazurerm_cognitive_account.res-1
# azurerm_cognitive_account.res-1:resource"azurerm_cognitive_account""res-1"{custom_subdomain_name="pichuang"dynamic_throttling_enabled=falseendpoint="https://pichuang.openai.azure.com/"fqdns=[]id="/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-azure-openai/providers/Microsoft.CognitiveServices/accounts/pichuang"kind="OpenAI"local_auth_enabled=truelocation="eastus2"name="pichuang"outbound_network_access_restricted=falseprimary_access_key=(sensitivevalue)public_network_access_enabled=trueresource_group_name="rg-azure-openai"secondary_access_key=(sensitivevalue)sku_name="S0"tags={"Environment"="production"}network_acls{default_action="Allow"ip_rules=[]}}
回復特定 Azure 資源狀態
有時候需要把資源狀態以特定時機點蓋回去,這時候你就要透過 terraform plan 來檢視差異,然後再透過 terraform apply 來回復狀態
傾向不要,當然如果你的資源不具備 Nested Resource Group 之類的特性,可以考慮試試看,但如果像 Azure Kubernetes Service 或者是 Azure Red Hat OpenShift 建立服務的時候都會額外再建立一個 Resource Group 放置一堆資源的話,那可能在 aztfexport 的時候會有問題,估計要手動一個一個下 terraform import 修補