I am using TFE, and the TFE REST API to apply my infrastructure when VCS changes.
Specifically, I am using TF to do the following steps:
- download a swagger api definition (http provider)
- import this api document into Azure’s API Management platform (azurerm_api_management_api - azurerm provider)
- add one api operation that is not included in the swagger doc (azurerm_api_management_api_operation)
The issue arises when the swagger doc is imported. By design Azure removes the existing apis and then imports the swagger doc. During planning, the straggler api option exists so it is not acted upon by TFE. The apply then blows away all the api options and rebuilds them except for that one api because the import action deleted it. The next apply, that one api is missing so it is re-created. So I have an api option missing every other apply.
Is there a lifecycle option to simply recreate this azurerm_api_management_api_operation every run? Or even only when azurerm_api_management_api is modified?
I am aware of the -replace flag on the cli, and it seems there may be a way to use this in the ‘/runs’ rest api with a data.attributes.replace-addrs payload. I am hesitant to do that because I have a boat load of apis and that would get messy.
I am asking here because I don’t think this is an issue with the azurerm provider.