We are thinking about using deployment slots for Azure Web / Function Apps, but are struggling with one issue and would like to know your thoughts / solutions about this. We think about doing the following:
- Deploy IaC for a Web App a. IaC defines app settings for a slot (without 'deployment slot settings' enabled, because we want the setting to move to the destination slot when doing a swap) b. IaC includes slot1 (production) i. key1: value1 ii. key2: value2 b. IaC includes slot2 (staging) i. key1: value3 ii. key2: value4
- Deploy code to Web App slot 2 (staging)
- Test Web App slot 2 (staging)
- Swap slot2 and slot1, so slot1 will contain the latest code we deployed with they slot2 app settings, which means after the swap we will have the following: a. slot 1 (production) i. key1: value3 ii. key2: value4 b. slot 2 (staging) i. key1: value1 ii. key2: value2
This looks great and is exactly what we want. But now when the IaC doesn't match with the status in Azure.
IaC contains: b. slot1 (production) i. key1: value1 ii. key2: value2 b. slot2 (staging) i. key1: value3 ii. key2: value4
But Azure contains (after the swap): a. slot 1 (production) i. key1: value3 ii. key2: value4 b. slot 2 (staging) i. key1: value1 ii. key2: value2
In a CI / CD pipeline, we don't want change IaC each time we do a deployment.
How do you cope with this issue? How do you use deployment slots and swapping without having this issue?