Closed jojoismael closed 9 months ago
Hello , first of all thanks to the entire terraform and the terraform azurerm provider teams for all of your great work and your hard work is truly appreciated by the community at large.
Previously, this was working perfectly fine , eg, revisions were being created successfully using our existing swagger files.
Then, I had to create a separate environment using our existing working terraform code base and then suddenly , we are getting this 400 error from the azurerm provider.
Tested both in azurerm 2.84 and 3.17 with same HTTP 400 results
In contrast, trying the same payload that was acquired from the terraform diagnostic log file in docs.micosoft.com (try button) results in a successful operation for both the base API and its ;rev-2
Please do take note that in both cases for the base API and revision=2, the same swagger file is being imported
Thanks so much for your assistance!
Update:
Modifying the swagger file’s title and description fields under “info” property to be the same as the name, display name, description and path in the terraform file has resulted on a different error on another field
From:
Message="Can't change property Name for non-current revision"
To:
Message="Can't change property ApiVersion for non-current revision"
│ Error: waiting on creating/updating API Management API "SampleApi" (Resource Group "rg-sample-api"): Future#WaitForCompletion: the number of retries has been exceeded: StatusCode=400 -- Original Error: Code="ValidationError" Message="Can't change property ApiVersion for non-current revision "
│
any thoughts? Thanks!
@jojoismael does working with revisions work for you now? I've noticed that with azurerm 3.17.0+ the revision in the state file is always set to "1", even so it's definitely configured with "2" etc.
I'm having this issue too, seeing this error message: "Can't change property ApiVersion for non-current revision"
We also face this error, so currently it is not possible to create revisions.
Updating PR linking for this issue - PR https://github.com/hashicorp/terraform-provider-azurerm/pull/22380 has been superseded by https://github.com/hashicorp/terraform-provider-azurerm/pull/23031.
I am trying to create a new revision an an existing APIM API, and still getting an error on azurerm 3.89.0
:
│ Error: creating/updating Api (Subscription: "xxx"
│ Resource Group Name: "xxx"
│ Service Name: "xxx"
│ Api: "my-api-id;rev=my-revision-id"): polling after CreateOrUpdate: executing request: unexpected status 404 with error: ResourceNotFound: Api not found.
│
│ with azurerm_api_management_api.apim_api_revision,
│ on main.tf line 14, in resource "azurerm_api_management_api" "apim_api_revision":
│ 14: resource "azurerm_api_management_api" "apim_api_revision" {
With the code:
resource "azurerm_api_management_api" "apim_api_revision" {
name = data.azurerm_api_management_api.apim_api.name
resource_group_name = data.azurerm_api_management_api.resource_group_name
api_management_name = data.azurerm_api_management_api.api_management_name
revision = "my-revision"
display_name = "my-revision"
source_api_id = data.azurerm_api_management_api.apim_api.id
import {
content_format = "openapi"
content_value = templatefile("${path.root}/openapi.yaml", {})
}
}
Am I doing something wrong, or is it the case that https://github.com/hashicorp/terraform-provider-azurerm/pull/23031 didn't solve the issue?
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Is there an existing issue for this?
Community Note
Terraform Version
1.2.6
AzureRM Provider Version
2.84, 3.17.0
Affected Resource(s)/Data Source(s)
azurerm_api_management_api
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
APIM API revision to be created in Azure portal, as per previous behaviour
Actual Behaviour
HTTP 400 returned with message: Can't change property Name for non-current revision
Steps to Reproduce
TF_LOG="TRACE" TF_LOG_PROVIDER="TRACE" TF_LOG_PATH="c:\tmp\terraform.txt"
AzureRM v 2.84 and v.3.17.0 returns error 400: Can't change property Name for non-current revision
Next, copy PUT payload from terraform log file and submit via https://docs.microsoft.com/en-us/rest/api/apimanagement/current-ga/apis/create-or-update?tabs=HTTP#code-try-0
Important Factoids
No response
References
No response