From 03964fc89df6e103f4b66b6c76a065fa1a2b3993 Mon Sep 17 00:00:00 2001 From: Al West Date: Tue, 26 Sep 2023 10:14:47 +0100 Subject: [PATCH] Use GitHub variable for feature polling interval * Create new variable in Terraform * Change application to use variable from GitHub * Update README * Update required actions --- .github/workflows/load-testing.yml | 1 + .github/workflows/terraform-destroy.yml | 1 + .github/workflows/terraform-plan.yml | 1 + .github/workflows/terraform.yml | 1 + Terraform/README.md | 9 +-------- Terraform/application.tf | 4 ++-- Terraform/variables.tf | 6 ++++++ 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/load-testing.yml b/.github/workflows/load-testing.yml index 1ea58e3d..a4027227 100644 --- a/.github/workflows/load-testing.yml +++ b/.github/workflows/load-testing.yml @@ -25,6 +25,7 @@ jobs: TF_VAR_cpd_delivery_key: ${{secrets.TF_VAR_CPD_DELIVERY_KEY}} TF_VAR_cpd_clarity: ${{secrets.TF_VAR_CPD_CLARITY}} TF_VAR_cpd_image_tag: ${{vars.TF_VAR_CPD_IMAGE_TAG}} + TF_VAR_cpd_feature_polling_interval: ${{vars.TF_VAR_CPD_FEATURE_POLLING_INTERVAL}} TF_WORKSPACE: Load-Test SITE_URL: https://20.107.65.156/ steps: diff --git a/.github/workflows/terraform-destroy.yml b/.github/workflows/terraform-destroy.yml index 6921d84f..fabb48cc 100644 --- a/.github/workflows/terraform-destroy.yml +++ b/.github/workflows/terraform-destroy.yml @@ -35,6 +35,7 @@ jobs: TF_VAR_cpd_delivery_key: ${{secrets.TF_VAR_CPD_DELIVERY_KEY}} TF_VAR_cpd_clarity: ${{secrets.TF_VAR_CPD_CLARITY}} TF_VAR_cpd_image_tag: ${{vars.TF_VAR_CPD_IMAGE_TAG}} + TF_VAR_cpd_feature_polling_interval: ${{vars.TF_VAR_CPD_FEATURE_POLLING_INTERVAL}} TF_WORKSPACE: ${{inputs.workspace}} defaults: diff --git a/.github/workflows/terraform-plan.yml b/.github/workflows/terraform-plan.yml index 253c2ad5..8d02ed91 100644 --- a/.github/workflows/terraform-plan.yml +++ b/.github/workflows/terraform-plan.yml @@ -38,6 +38,7 @@ jobs: TF_VAR_cpd_delivery_key: ${{secrets.TF_VAR_CPD_DELIVERY_KEY}} TF_VAR_cpd_clarity: ${{secrets.TF_VAR_CPD_CLARITY}} TF_VAR_cpd_image_tag: ${{vars.TF_VAR_CPD_IMAGE_TAG}} + TF_VAR_cpd_feature_polling_interval: ${{vars.TF_VAR_CPD_FEATURE_POLLING_INTERVAL}} TF_WORKSPACE: ${{inputs.workspace}} defaults: diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 002e6a52..b6258daf 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -38,6 +38,7 @@ jobs: TF_VAR_cpd_delivery_key: ${{secrets.TF_VAR_CPD_DELIVERY_KEY}} TF_VAR_cpd_clarity: ${{secrets.TF_VAR_CPD_CLARITY}} TF_VAR_cpd_image_tag: ${{vars.TF_VAR_CPD_IMAGE_TAG}} + TF_VAR_cpd_feature_polling_interval: ${{vars.TF_VAR_CPD_FEATURE_POLLING_INTERVAL}} TF_WORKSPACE: ${{inputs.workspace}} defaults: diff --git a/Terraform/README.md b/Terraform/README.md index 0ed7f230..58734d3c 100644 --- a/Terraform/README.md +++ b/Terraform/README.md @@ -22,14 +22,7 @@ No modules. | [azurerm_application_gateway.appgw](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/application_gateway) | resource | | [azurerm_linux_web_app.linux-web-app](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/linux_web_app) | resource | | [azurerm_linux_web_app_slot.staging](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/linux_web_app_slot) | resource | -| [azurerm_monitor_action_group.main](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_action_group) | resource | -| [azurerm_monitor_activity_log_alert.appgw-health](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_activity_log_alert) | resource | | [azurerm_monitor_autoscale_setting.autoscale](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_autoscale_setting) | resource | -| [azurerm_monitor_metric_alert.appgw-backend-connect-time](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_metric_alert) | resource | -| [azurerm_monitor_metric_alert.appgw-managed-rules](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_metric_alert) | resource | -| [azurerm_monitor_metric_alert.container-avg-resp-time](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_metric_alert) | resource | -| [azurerm_monitor_metric_alert.container-cpu](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_metric_alert) | resource | -| [azurerm_monitor_metric_alert.failed-requests](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/monitor_metric_alert) | resource | | [azurerm_network_interface.nic](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/network_interface) | resource | | [azurerm_network_security_group.nsg](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/network_security_group) | resource | | [azurerm_network_security_rule.dev-whitelist-rules](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/resources/network_security_rule) | resource | @@ -46,7 +39,6 @@ No modules. | [azurerm_application_insights.appinsights](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/application_insights) | data source | | [azurerm_key_vault.kv](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/key_vault) | data source | | [azurerm_key_vault_secret.dev-ips](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.email](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.ips](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/key_vault_secret) | data source | | [azurerm_log_analytics_workspace.log-analytics-ws](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/log_analytics_workspace) | data source | | [azurerm_public_ip.pip1](https://registry.terraform.io/providers/hashicorp/azurerm/3.52.0/docs/data-sources/public_ip) | data source | @@ -77,6 +69,7 @@ No modules. | [cpd\_clarity](#input\_cpd\_clarity) | MS Clarity Secret | `string` | n/a | yes | | [cpd\_contentful\_env](#input\_cpd\_contentful\_env) | Contentful Environment Name | `map(string)` |
{
"Dev": "dev",
"Load-Test": "test",
"Pre-Prod": "prod",
"Prod": "prod",
"Test": "test"
}
| no | | [cpd\_delivery\_key](#input\_cpd\_delivery\_key) | Contentful Delivery Key | `string` | n/a | yes | +| [cpd\_feature\_polling\_interval](#input\_cpd\_feature\_polling\_interval) | Feature polling interval | `number` | n/a | yes | | [cpd\_googleanalyticstag](#input\_cpd\_googleanalyticstag) | Google Analytics Tag | `string` | n/a | yes | | [cpd\_image\_tag](#input\_cpd\_image\_tag) | Docker image tag of application | `string` | n/a | yes | | [cpd\_preview\_key](#input\_cpd\_preview\_key) | Contentful Preview Key | `string` | n/a | yes | diff --git a/Terraform/application.tf b/Terraform/application.tf index 6bfe7e82..0153f4d0 100644 --- a/Terraform/application.tf +++ b/Terraform/application.tf @@ -25,7 +25,7 @@ resource "azurerm_linux_web_app" "linux-web-app" { CPD_CONTENTFUL_ENVIRONMENT = var.cpd_contentful_env[terraform.workspace] CPD_INSTRUMENTATION_CONNECTIONSTRING = data.azurerm_application_insights.appinsights.connection_string CPD_CLARITY = var.cpd_clarity - CPD_FEATURE_POLLING_INTERVAL = 300 + CPD_FEATURE_POLLING_INTERVAL = var.cpd_feature_polling_interval DOCKER_ENABLE_CI = "true" } @@ -64,7 +64,7 @@ resource "azurerm_linux_web_app_slot" "staging" { CPD_CONTENTFUL_ENVIRONMENT = var.cpd_contentful_env[terraform.workspace] CPD_INSTRUMENTATION_CONNECTIONSTRING = data.azurerm_application_insights.appinsights.connection_string CPD_CLARITY = var.cpd_clarity - CPD_FEATURE_POLLING_INTERVAL = 300 + CPD_FEATURE_POLLING_INTERVAL = var.cpd_feature_polling_interval DOCKER_ENABLE_CI = "true" } diff --git a/Terraform/variables.tf b/Terraform/variables.tf index 09214f8a..0269a2fd 100644 --- a/Terraform/variables.tf +++ b/Terraform/variables.tf @@ -630,6 +630,12 @@ variable "cpd_clarity" { description = "MS Clarity Secret" } +variable "cpd_feature_polling_interval" { + type = number + sensitive = true + description = "Feature polling interval" +} + variable "cpd_contentful_env" { type = map(string) default = {