I have a situation where I import a swagger.json file into an Azure APIM API, but not all of my endpoints are defined there, so I have a separate resource that creates an additional operation. (I have it split because of applying different policies to them.)
If nothing exists in Azure, everything works as expected and all of my endpoints are created. Afterward, when I have an update to the swagger.json file, the import procedure removes all of the endpoints, importing the swagger.json as “brand new”. This drops the endpoint from Azure that I created with the extra resource.
Since the state file believes both the swagger-generated endpoints and the “extra” one are there, the terraform plan only plans to perform the import. When it does that, I have to rerun my pipeline to have the extra endpoint recreated.
How can I force the “extra” endpoint to get created every time both it changes AND when the swagger file is updated? Is there a way to force that? Another option might be to make the swagger import only update those endpoints that are defined there, but I don’t know how to do that, either.