Skip to content

Commit c170358

Browse files
feat: add configurable wait before zip deploy for SCM settings propagation (#265)
* feat: add configurable wait before zip deploy for SCM settings propagation Add a time_sleep resource between app settings/connection strings configuration and zip deploy to allow the SCM site to pick up settings like SCM_DO_BUILD_DURING_DEPLOYMENT before the deploy triggers. - Add hashicorp/time provider - Add zip_deploy_wait_duration variable (default 60s) - Add time_sleep.wait_for_app_settings resource before zip deploy * docs: update README for zip_deploy_wait_duration
1 parent e6a6d28 commit c170358

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The following requirements are needed by this module:
1919

2020
- <a name="requirement_random"></a> [random](#requirement\_random) (>= 3.5.0, < 4.0.0)
2121

22+
- <a name="requirement_time"></a> [time](#requirement\_time) (>= 0.9.0, < 1.0.0)
23+
2224
## Resources
2325

2426
The following resources are used by this module:
@@ -34,6 +36,7 @@ The following resources are used by this module:
3436
- [azapi_resource_action.active_slot](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource_action) (resource)
3537
- [modtm_telemetry.telemetry](https://registry.terraform.io/providers/azure/modtm/latest/docs/resources/telemetry) (resource)
3638
- [random_uuid.telemetry](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) (resource)
39+
- [time_sleep.wait_for_app_settings](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) (resource)
3740
- [azapi_client_config.telemetry](https://registry.terraform.io/providers/Azure/azapi/latest/docs/data-sources/client_config) (data source)
3841
- [modtm_module_source.telemetry](https://registry.terraform.io/providers/azure/modtm/latest/docs/data-sources/module_source) (data source)
3942

@@ -2257,6 +2260,14 @@ Type: `string`
22572260

22582261
Default: `null`
22592262

2263+
### <a name="input_zip_deploy_wait_duration"></a> [zip\_deploy\_wait\_duration](#input\_zip\_deploy\_wait\_duration)
2264+
2265+
Description: The duration to wait after applying app settings and connection strings before triggering zip deploy. This allows the SCM site to pick up settings like `SCM_DO_BUILD_DURING_DEPLOYMENT` before the deploy starts.
2266+
2267+
Type: `string`
2268+
2269+
Default: `"60s"`
2270+
22602271
## Outputs
22612272

22622273
The following outputs are exported:

main.deploy.tf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
resource "time_sleep" "wait_for_app_settings" {
2+
for_each = var.zip_deploy_file != null ? { "default" = {} } : {}
3+
4+
create_duration = var.zip_deploy_wait_duration
5+
6+
depends_on = [
7+
module.config_appsettings,
8+
module.config_connectionstrings,
9+
]
10+
}
11+
112
module "extensions_zipdeploy" {
213
source = "./modules/extensions_zipdeploy"
314
for_each = var.zip_deploy_file != null ? { "default" = {} } : {}
@@ -6,7 +17,6 @@ module "extensions_zipdeploy" {
617
zip_deploy_file = var.zip_deploy_file
718

819
depends_on = [
9-
module.config_appsettings,
10-
module.config_connectionstrings,
20+
time_sleep.wait_for_app_settings,
1121
]
1222
}

terraform.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ terraform {
1414
source = "hashicorp/random"
1515
version = ">= 3.5.0, < 4.0.0"
1616
}
17+
time = {
18+
source = "hashicorp/time"
19+
version = ">= 0.9.0, < 1.0.0"
20+
}
1721
}
1822
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,3 +2082,9 @@ variable "zip_deploy_file" {
20822082
default = null
20832083
description = "The path to the zip file to deploy to the App Service."
20842084
}
2085+
2086+
variable "zip_deploy_wait_duration" {
2087+
type = string
2088+
default = "60s"
2089+
description = "The duration to wait after applying app settings and connection strings before triggering zip deploy. This allows the SCM site to pick up settings like `SCM_DO_BUILD_DURING_DEPLOYMENT` before the deploy starts."
2090+
}

0 commit comments

Comments
 (0)