Azure APIM creation fails giving error: ResourceNotFound

I am getting “State storage *statemgr.Filesystem declined to persist a state snapshot” error while creating APIM resource using terraform.
My terraform files looks as:

resource "azurerm_api_management_api" "example" {
  for_each = var.apimanagementapi
  name                = each.value["name"]
  resource_group_name = var.resource_group_name
  api_management_name = var.api_management_name
  revision            = each.value["revision"]
  display_name        = each.value["display_name"]
  path                = each.value["path"]
  protocols           = each.value["protocols"]
  subscription_required = true

  import {
    content_format = "openapi"
    content_value  = file(each.value["content_value"])
  }
  depends_on = [ azurerm_api_management_backend.example ]
}

the variable.tf looks like:

variable "apimanagementapi" {
      type = map(any)
      default = {
          apimanagementapi_1 = {
            name                = "open-api-advtech"
            revision            = "1"
            display_name        = "open-api-advtech"
            path                = "openai"
            protocols           = ["https"]
            content_value       = "./modules/advtech-azure-apim/inference.json"
          },
          apimanagementapi_2 = {
            name                = "open-api-vofc"
            revision            = "1"
            display_name        = "open-api-vofc"
            path                = "vofc/openai"
            protocols           = ["https"]
            content_value       = "./modules/advtech-azure-apim/inference.json"
          }
      } 
    }

Error logs is as blow

module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_2"]: Creating...
module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_1"]: Creating...
2024-06-08T12:02:56.057-0700 [INFO]  Starting apply for module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_1"]
2024-06-08T12:02:56.057-0700 [INFO]  Starting apply for module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_2"]
2024-06-08T12:02:56.057-0700 [DEBUG] module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_1"]: applying the planned Create change
2024-06-08T12:02:56.057-0700 [DEBUG] module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_2"]: applying the planned Create change
2024-06-08T12:02:56.058-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: setting computed for "subscription_key_parameter_names" from ComputedKeys: timestamp=2024-06-08T12:02:56.058-0700
2024-06-08T12:02:56.058-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: setting computed for "subscription_key_parameter_names" from ComputedKeys: timestamp=2024-06-08T12:02:56.058-0700
2024-06-08T12:02:56.058-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Request: 
GET /subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 api/2022-08-01) HashiCorp Terraform/1.5.7 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.105.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
Accept-Encoding: gzip: timestamp=2024-06-08T12:02:56.058-0700
2024-06-08T12:02:56.058-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: GET https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01: timestamp=2024-06-08T12:02:56.058-0700
2024-06-08T12:02:56.058-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Request: 
GET /subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 api/2022-08-01) HashiCorp Terraform/1.5.7 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.105.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
Accept-Encoding: gzip: timestamp=2024-06-08T12:02:56.058-0700
2024-06-08T12:02:56.058-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: GET https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01: timestamp=2024-06-08T12:02:56.058-0700
2024-06-08T12:02:56.364-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Response for https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01: 
HTTP/2.0 404 Not Found
Content-Length: 79
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Sat, 08 Jun 2024 19:02:55 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Ratelimit-Remaining-Subscription-Global-Reads: 3749
X-Ms-Ratelimit-Remaining-Subscription-Reads: 249
X-Ms-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Routing-Request-Id: WESTUS:20240608T190256Z:4ea3333b-4867-4303-aa3b-9946542ab22a
X-Msedge-Ref: Ref A: AC40CD3A5235415FA784188A79ADC474 Ref B: SJC211051204017 Ref C: 2024-06-08T19:02:56Z

{"error":{"code":"ResourceNotFound","message":"Api not found.","details":null}}: timestamp=2024-06-08T12:02:56.364-0700
2024-06-08T12:02:56.365-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: Importing API Management API "open-api-vofc;rev=1" of type "openapi": timestamp=2024-06-08T12:02:56.364-0700
2024-06-08T12:02:56.367-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Request: 
PUT /subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 api/2022-08-01) HashiCorp Terraform/1.5.7 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.105.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Length: 35342
Accept: application/json; charset=utf-8; IEEE754Compatible=false
Content-Type: application/json; charset=utf-8
Odata-Maxversion: 4.0
Odata-Version: 4.0
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
Accept-Encoding: gzip

------

2024-06-08T12:02:56.369-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: PUT https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01: timestamp=2024-06-08T12:02:56.366-0700
2024-06-08T12:02:56.377-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Response for https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01: 
HTTP/2.0 404 Not Found
Content-Length: 79
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Sat, 08 Jun 2024 19:02:55 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Ratelimit-Remaining-Subscription-Global-Reads: 3749
X-Ms-Ratelimit-Remaining-Subscription-Reads: 249
X-Ms-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Routing-Request-Id: WESTUS:20240608T190256Z:95825cb0-8247-46c0-96d7-63d8916571eb
X-Msedge-Ref: Ref A: 86FACCBC6C344D1E9D6EF47E8EAFC161 Ref B: SJC211051205017 Ref C: 2024-06-08T19:02:56Z

{"error":{"code":"ResourceNotFound","message":"Api not found.","details":null}}: timestamp=2024-06-08T12:02:56.377-0700
2024-06-08T12:02:56.377-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: Importing API Management API "open-api-advtech;rev=1" of type "openapi": timestamp=2024-06-08T12:02:56.377-0700
2024-06-08T12:02:56.379-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Request: 
PUT /subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 api/2022-08-01) HashiCorp Terraform/1.5.7 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.105.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Length: 35337
Accept: application/json; charset=utf-8; IEEE754Compatible=false
Content-Type: application/json; charset=utf-8
Odata-Maxversion: 4.0
Odata-Version: 4.0
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
Accept-Encoding: gzip

-----

2024-06-08T12:02:56.381-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: PUT https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01: timestamp=2024-06-08T12:02:56.378-0700
2024-06-08T12:02:56.889-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Response for https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01: 
HTTP/2.0 202 Accepted
Content-Length: 0
Cache-Control: no-cache
Date: Sat, 08 Jun 2024 19:02:56 GMT
Expires: -1
Location: https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01&asyncId=6664aae05ddd1705e80e93bc&asyncCode=201
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Ratelimit-Remaining-Subscription-Global-Writes: 2999
X-Ms-Ratelimit-Remaining-Subscription-Writes: 199
X-Ms-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Routing-Request-Id: WESTUS:20240608T190257Z:46b22937-84e3-40c0-8b4a-66e951138a90
X-Msedge-Ref: Ref A: E4030C7602A54C9A89FCDC320AE999BA Ref B: SJC211051204011 Ref C: 2024-06-08T19:02:56Z: timestamp=2024-06-08T12:02:56.889-0700
2024-06-08T12:02:56.902-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Response for https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01: 
HTTP/2.0 202 Accepted
Content-Length: 0
Cache-Control: no-cache
Date: Sat, 08 Jun 2024 19:02:56 GMT
Expires: -1
Location: https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01&asyncId=6664aae05ddd1705e80e93bf&asyncCode=201
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Ratelimit-Remaining-Subscription-Global-Writes: 2999
X-Ms-Ratelimit-Remaining-Subscription-Writes: 199
X-Ms-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Routing-Request-Id: WESTUS:20240608T190257Z:d906da00-f4a9-453d-99eb-f792cfacab51
X-Msedge-Ref: Ref A: EF825C09ED0548BDA3F5C440F9FE9B8C Ref B: SJC211051204011 Ref C: 2024-06-08T19:02:56Z: timestamp=2024-06-08T12:02:56.902-0700
module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_2"]: Still creating... [10s elapsed]
module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_1"]: Still creating... [10s elapsed]
2024-06-08T12:03:06.891-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Request: 
GET /subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 api/2022-08-01) HashiCorp Terraform/1.5.7 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.105.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Accept: application/json; charset=utf-8; IEEE754Compatible=false
Content-Type: application/json; charset=utf-8
Odata-Maxversion: 4.0
Odata-Version: 4.0
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
Accept-Encoding: gzip: timestamp=2024-06-08T12:03:06.890-0700
2024-06-08T12:03:06.891-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: GET https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01: timestamp=2024-06-08T12:03:06.891-0700
2024-06-08T12:03:06.904-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Request: 
GET /subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 api/2022-08-01) HashiCorp Terraform/1.5.7 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.105.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Accept: application/json; charset=utf-8; IEEE754Compatible=false
Content-Type: application/json; charset=utf-8
Odata-Maxversion: 4.0
Odata-Version: 4.0
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
Accept-Encoding: gzip: timestamp=2024-06-08T12:03:06.903-0700
2024-06-08T12:03:06.904-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: GET https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01: timestamp=2024-06-08T12:03:06.903-0700
2024-06-08T12:03:07.377-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Response for https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-vofc;rev=1?api-version=2022-08-01: 
HTTP/2.0 404 Not Found
Content-Length: 79
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Sat, 08 Jun 2024 19:03:06 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Ratelimit-Remaining-Subscription-Global-Reads: 3749
X-Ms-Ratelimit-Remaining-Subscription-Reads: 249
X-Ms-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Routing-Request-Id: WESTUS:20240608T190307Z:af2609b0-71ae-43ab-8278-6d2e7ff42cd9
X-Msedge-Ref: Ref A: ABFE978BDB3A412CAC443C3A3798D92C Ref B: SJC211051204033 Ref C: 2024-06-08T19:03:07Z

{"error":{"code":"ResourceNotFound","message":"Api not found.","details":null}}: timestamp=2024-06-08T12:03:07.377-0700
2024-06-08T12:03:07.377-0700 [ERROR] provider.terraform-provider-azurerm_v3.105.0_x5: Response contains error diagnostic: tf_provider_addr=provider tf_rpc=ApplyResourceChange @module=sdk.proto tf_req_id=8c1a8d56-a2aa-d789-3bd0-4d5125461894 tf_resource_type=azurerm_api_management_api tf_proto_version=5.4 diagnostic_detail= diagnostic_summary="creating/updating Api (Subscription: "1234-2342-2112-2323-2323-232323322"
Resource Group Name: "test-resource-group"
Service Name: "sbx-apim"
Api: "open-api-vofc;rev=1"): polling after CreateOrUpdate: executing request: unexpected status 404 (404 Not Found) with error: ResourceNotFound: Api not found." @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_severity=ERROR timestamp=2024-06-08T12:03:07.377-0700
2024-06-08T12:03:07.395-0700 [DEBUG] provider.terraform-provider-azurerm_v3.105.0_x5: AzureRM Response for https://management.azure.com/subscriptions/1234-2342-2112-2323-2323-232323322/resourceGroups/test-resource-group/providers/Microsoft.ApiManagement/service/sbx-apim/apis/open-api-advtech;rev=1?api-version=2022-08-01: 
HTTP/2.0 404 Not Found
Content-Length: 79
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Sat, 08 Jun 2024 19:03:07 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Ratelimit-Remaining-Subscription-Global-Reads: 3749
X-Ms-Ratelimit-Remaining-Subscription-Reads: 249
X-Ms-Request-Id: de92899f-c5af-cc29-8589-017473940aee
X-Ms-Routing-Request-Id: WESTUS:20240608T190307Z:7b1079c0-9a1a-483e-a52a-b6764d71e1bc
X-Msedge-Ref: Ref A: 410B667A48B0457B89205753F1E0F738 Ref B: SJC211051205039 Ref C: 2024-06-08T19:03:07Z

{"error":{"code":"ResourceNotFound","message":"Api not found.","details":null}}: timestamp=2024-06-08T12:03:07.395-0700
2024-06-08T12:03:07.395-0700 [ERROR] provider.terraform-provider-azurerm_v3.105.0_x5: Response contains error diagnostic: tf_proto_version=5.4 @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_detail= diagnostic_severity=ERROR tf_req_id=3da1cd41-a121-35c5-8c8b-afd45ba15301 tf_resource_type=azurerm_api_management_api tf_provider_addr=provider tf_rpc=ApplyResourceChange @module=sdk.proto diagnostic_summary="creating/updating Api (Subscription: "1234-2342-2112-2323-2323-232323322"
Resource Group Name: "test-resource-group"
Service Name: "sbx-apim"
Api: "open-api-advtech;rev=1"): polling after CreateOrUpdate: executing request: unexpected status 404 (404 Not Found) with error: ResourceNotFound: Api not found." timestamp=2024-06-08T12:03:07.395-0700
2024-06-08T12:03:07.415-0700 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-06-08T12:03:07.415-0700 [ERROR] vertex "module.advtech-azure-apim.azurerm_api_management_api.example[\"apimanagementapi_2\"]" error: creating/updating Api (Subscription: "1234-2342-2112-2323-2323-232323322"
Resource Group Name: "test-resource-group"
Service Name: "sbx-apim"
Api: "open-api-vofc;rev=1"): polling after CreateOrUpdate: executing request: unexpected status 404 (404 Not Found) with error: ResourceNotFound: Api not found.
2024-06-08T12:03:07.431-0700 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-06-08T12:03:07.431-0700 [ERROR] vertex "module.advtech-azure-apim.azurerm_api_management_api.example[\"apimanagementapi_1\"]" error: creating/updating Api (Subscription: "1234-2342-2112-2323-2323-232323322"
Resource Group Name: "test-resource-group"
Service Name: "sbx-apim"
Api: "open-api-advtech;rev=1"): polling after CreateOrUpdate: executing request: unexpected status 404 (404 Not Found) with error: ResourceNotFound: Api not found.
╷
│ Error: creating/updating Api (Subscription: "1234-2342-2112-2323-2323-232323322"
│ Resource Group Name: "test-resource-group"
│ Service Name: "sbx-apim"
│ Api: "open-api-advtech;rev=1"): polling after CreateOrUpdate: executing request: unexpected status 404 (404 Not Found) with error: ResourceNotFound: Api not found.
│ 
│   with module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_1"],
│   on modules/advtech-azure-apim/main.tf line 163, in resource "azurerm_api_management_api" "example":
│  163: resource "azurerm_api_management_api" "example" {
│ 
╵
╷
│ Error: creating/updating Api (Subscription: "1234-2342-2112-2323-2323-232323322"
│ Resource Group Name: "test-resource-group"
│ Service Name: "sbx-apim"
│ Api: "open-api-vofc;rev=1"): polling after CreateOrUpdate: executing request: unexpected status 404 (404 Not Found) with error: ResourceNotFound: Api not found.
│ 
│   with module.advtech-azure-apim.azurerm_api_management_api.example["apimanagementapi_2"],
│   on modules/advtech-azure-apim/main.tf line 163, in resource "azurerm_api_management_api" "example":
│  163: resource "azurerm_api_management_api" "example" {
│ 
╵
2024-06-08T12:03:07.451-0700 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-06-08T12:03:07.454-0700 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/azurerm/3.105.0/darwin_arm64/terraform-provider-azurerm_v3.105.0_x5 pid=26110
2024-06-08T12:03:07.454-0700 [DEBUG] provider: plugin exited

Hi @harpreetset,

I’m afraid I don’t have a solution for you, but it seems that you are seeing the same as this issue: Unable to create azurerm_api_management_api with imported content file with azurerm > 3.69.0 · Issue #23322 · hashicorp/terraform-provider-azurerm (github.com)

which looks like it has most recently been attributed to an upstream Terraform SDK issue

You may wish to review, subscribe and :+1: on those issues and provide relevant input regarding your specific scenario if appropriate.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.