From 725190147b16fde530b36b95675566dcfbed9e02 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Fri, 19 Apr 2024 12:42:27 +0100 Subject: [PATCH] Add variables to allow changing registry * Bumps the container-app-hosting module to v1.6.1 which allows changing the registry server without removing the default ACR * Adds the `registry_server` variable, used in the module --- terraform/.terraform.lock.hcl | 90 +++++++++++++---------------- terraform/README.md | 3 +- terraform/container-apps-hosting.tf | 5 +- terraform/locals.tf | 3 +- terraform/variables.tf | 16 +++-- 5 files changed, 58 insertions(+), 59 deletions(-) diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl index 4ef81e953..c866a6b31 100644 --- a/terraform/.terraform.lock.hcl +++ b/terraform/.terraform.lock.hcl @@ -2,71 +2,61 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/azure/azapi" { - version = "1.12.0" + version = "1.12.1" constraints = ">= 1.6.0" hashes = [ - "h1:dxnFwPDP9N4m1S8CijiKEADQRpRFYl8I8YMjV2H2I6E=", - "zh:3def34214701bc7f13c2b94bbaae536fc2426d0742ab4586e88f5d88116270dd", - "zh:6f7803c889edaaf688f02eabdff244aebb38dd41c21210f323fd9f9d6fc2d519", - "zh:839b33000dbec2fcfaf384bfb3c92d62d003be35a27c48dd4421ab7df8d3ec89", - "zh:9847bfaaf708c60e373f9434d330a9c2388da8fbf95a3c18c5c66bab45d8f205", - "zh:9aaf416a714cf6fca13fbed8136c72972afbecffdc8ba1f8621093974779c66d", - "zh:9c6b35899bebeba6e7533e5eac64629449b7e38b950ef1efa918808848387d2c", - "zh:a133daf1443052dc2b37a6857fb5b3ff967802133b99824880e8848174f49c03", - "zh:b57864d49d13dd5d5f28ad00e894c5c8016a766c0d159b984787b2765223859e", - "zh:b6526bc5c73dd08d011d621b59528cf13e61c133946dcbc64885352a9534458c", - "zh:c2fd17e0ed818bccacaa2d21ac28e1525ba33c31763816c9b53d645515f1e87a", - "zh:e828a606b09baec611f94d5dd99dbe7609ae5e79f274738a3e3f56d59021601b", - "zh:ff1d835ddf25a348e133679f46c12ddd1e5ae345ae8a86df16554493ce8aa177", + "h1:EaQL7pQCRm5iL2zy/dG7rOe2OZ0ZypuyVnpQAiAwJmM=", + "zh:1cf52e685ceb04e73e13fbf3f3036bff23a3274a4ceda8693c0612076a588166", + "zh:321b59c2a67c6cb4e5cf0dbe2cc978f5389d781e8b391f9b75bf4d830abd2ffe", + "zh:49046bd8020c3b44c6b5dc67041f181e4fff45e3bc1a9ff0646dd20c21c8ce47", + "zh:5784d0c326ec4825571577bc39b253019bd3b1030c19d67ca3436df2d7ba01c8", + "zh:5ad7e18d26f170c01888d8e65dab7aa475089aac7bf0106526fd57cdd56533bc", + "zh:6695854f4f655673bea85e37444bf0c070b440dba4bc269aa144d0f6b7c1cc5f", + "zh:7f372c897da6b9ad90869a8eb85b37dad4dff2d5d311b3eca1a2e6373e2271ed", + "zh:8afa1a2be1dada4e8be4ab72d9d56f36af1e486c9353d04aabf6e79db7310125", + "zh:90809364619238c45185bff25c7d9c4fde34253561d8183ebbe797456c44bc9c", + "zh:9338d44650c9e68e10a6bc2d69f7beacd5059e6ac681d2e388e80a1652d9c183", + "zh:c94ee6fb1df2c1d35f338107b5e73cdba86c4ecf9dcde95e2ca0132cbbd4bd7c", + "zh:de231d363b1a664c6b5d3af8d3b9cf542d04d4506fb9458ba6c8ebf94e0e32ae", ] } provider "registry.terraform.io/hashicorp/azuread" { - version = "2.47.0" + version = "2.48.0" constraints = ">= 2.37.1" hashes = [ - "h1:g8+gBFM4QVOEQFqAEs5pR6iXpbGvgPvcEi1evHwziyw=", - "zh:1372d81eb24ef3b4b00ea350fe87219f22da51691b8e42ce91d662f6c2a8af5e", + "h1:0R8yR32NSZvH93C1o4cdmhdRkjc1uBZD5UtiexTVcOk=", + "zh:0ec4f1ca1825f038001173c40f4b6edbdbc71d018d782b45c22d5e272ca0ec16", "zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7", - "zh:1e654a74d171d6ff8f9f6f67e3ff1421d4c5e56a18607703626bf12cd23ba001", - "zh:35227fad617a0509c64ab5759a8b703b10d244877f1aa5416bfbcc100c96996f", - "zh:357f553f0d78d46a96c7b2ed06d25ee0fc60fc5be19812ccb5d969fa47d62e17", - "zh:58faa2940065137e3e87d02eba59ab5cd7137d7a18caf225e660d1788f274569", - "zh:7308eda0339620fa24f47cedd22221fc2c02cab9d5be1710c09a783aea84eb3a", - "zh:863eabf7f908a8263e28d8aa2ad1381affd6bb5c67755216781f674ef214100e", - "zh:8b95b595a7c14ed7b56194d03cdec253527e7a146c1c58961be09e6b5c50baee", - "zh:afbca6b4fac9a0a488bc22ff9e51a8f14e986137d25275068fd932f379a51d57", - "zh:c6aadec4c81a44c3ffc22c2d90ffc6706bf5a9a903a395d896477516f4be6cbb", - "zh:e54a59de7d4ef0f3a18f91fed0b54a2bce18257ae2ee1df8a88226e1023c5811", + "zh:22154cd497009b5b1cb6b87131b3f31521b3de392ade1ac64dade3f29b03f8d0", + "zh:2723fe574d7a89242bd642b896ff7006d36f8a5d5a7c3876c7e1e2ada567d599", + "zh:2858abe3209fa0035419a4b2f8f155878fb6ecbc64f72c6f726dad583b1c8217", + "zh:3ba51d3e3ba6f12e8e12b043d7bc5f4415fc1ac08b81306ad546fe1ca2a3aa32", + "zh:49a39fb3713ba1a58fcb7b040bc4430ab4edb5116e8d7d33b73361f07febaead", + "zh:6a043d62a9cbfb805040e33e700cdcbfb5f199a74ae3867fc10c6810741ab222", + "zh:906c0961425d5854b22c9fed4d319248a7c88f0037547ea8472998720487ae25", + "zh:a1d246d8e0362afe397f0aedf0e68cf7d920fbae1adb88841f63dc98c06e5888", + "zh:c7df4d912c970600d9cba97a60c84b1a4ad1031feb723021c6984d99b320fd5c", + "zh:e8fbec893b4feb4410185126f2421ef0bdbbb102d1370ed72bb65b99d8869b98", ] } provider "registry.terraform.io/hashicorp/azurerm" { - version = "3.97.1" + version = "3.100.0" constraints = ">= 3.52.0, >= 3.76.0" hashes = [ - "h1:BwJ5YxCiTTAKKp1klZff5QtiVhSbyTfzYFtpdOWqnak=", - "h1:KeLerjC1aXonyejeICeK2RAmpmI09L7wlpBGPzjhrIM=", - "h1:LtwGbd4HEb5QCXmdxSvTjPSh8/Gp8eAQMYfiAKaubV4=", - "h1:WUn7GuDhHauFGikeA5I51dd0WUUff/mb7kS0Y4+cn5g=", - "h1:b8yfRYs+CepOlnx1JeQVMTX3N6HHfS85iOXE8hn8yok=", - "h1:i3JhTEx36J2yzdtSwPsOG/q5jH+9QPeW7TAEETfJIx4=", - "h1:igX3Zq92T1+K7++h5r1hbPpcYWoyfkROBjfE/YLgVmA=", - "h1:klBuN2uVZF7AVMhskbbgF8pygyhPBxsjedB1GUV79PA=", - "h1:m5wyoRGjbVfJU2YaGZrN1lfGgjpyuwi7Ykw1uHdwlAg=", - "h1:sdtr/GFxy7sfbdo02hJoxnoqGB+WjmDy7W2viTQzcaY=", - "h1:vwYchGsh1TY+/GjUv6CUS6It2opnMYYYVt4GBvCmesY=", - "zh:15171efcc3aa3a37748c502c493cb16ecff603b81ada4499a843574976bac524", - "zh:2ca6c13a4a96f67763ecced0015c7b101ee02d54ea54b28a8df4ae06468071b1", - "zh:2e3c77dbfd8f760132ecef2d6117e939cbea26b96aba5e4d926e7f7f0f7afe72", - "zh:4bc346eece1622be93c73801d8256502b11fd7c2e7f7cea12d048bb9fc9fe900", - "zh:4f1042942ed8d0433680a367527289459d43b0894a51eaba83ac414e80d5187f", - "zh:63e674c31482ae3579ea84daf5b1ba066ce40cb23475f54e17b6b131320a1bec", - "zh:8327148766dcb7a174673729a832c8095d7e137d0e6c7e2a9a01da48b8b73fbe", - "zh:851b3ae417059a80c7813e7f0063298a590a42f056004f2c2558ea14061c207e", - "zh:ac081b48907139c121a422ae9b1f40fc72c6aaaeb05cbdbf848102a6a5f426f4", - "zh:dc1d663df2d95e4ba91070ceb20d3560b6ea5c465d39c57a5979319302643e41", - "zh:ed26457367cbbb94237e935d297cb31b5687f9abf697377da0ee46974480db9b", + "h1:ikA/yAt8g/dS+FcbNBPY6E2KVafjNKkiUCOZmyiTfwY=", + "zh:20c3259fd94ab41c6c3425fb428d8bd279addb755c8ea1fe0b3e1c3bea4363cb", + "zh:4c4a8d5dbd8a9d7b60934b0ffed442fe50ab1b0559b9693399e3f66eca53d045", + "zh:7c21f569b839e40d4976beb6143adaccc5688d1a754dde054cb6f19ca33576b2", + "zh:88042b599de9ff8ec200e26636e06682e024a28331c4c48db8589d6a03279a8a", + "zh:95c20834eee3b46a85e338988bf14a9a70f74f9cae45ec934cf157dedaa40f28", + "zh:beeed81f4483dec0b64bf1aaf611c5030ad6e4c88c4bd75f956835653a1a29c0", + "zh:d76fa7371648b5bdc17115b5e42fa616fe4c6d2998f727a0956c0bddc4842365", + "zh:d89fcaa83a1ff7c9f29c49b31c60c29d8a84486e11d34573d767a5cd208da7d8", + "zh:ddbe18aee99fb7e2c93343f7f8a95837461a047ca660553c88c873761205ed76", + "zh:e6e70c7635bb4472810bfd0a31949640e72c535e6e8707454ea7e86dcb5fcd89", + "zh:f0575689ce28e220bc8daa4d2fefbfd90afde01a14343c61dfd6489960e22ff4", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", ] } diff --git a/terraform/README.md b/terraform/README.md index 17a0ecae6..b518c281a 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -136,7 +136,7 @@ No providers. | Name | Source | Version | |------|--------|---------| -| [azure\_container\_apps\_hosting](#module\_azure\_container\_apps\_hosting) | github.com/DFE-Digital/terraform-azurerm-container-apps-hosting | v1.5.1 | +| [azure\_container\_apps\_hosting](#module\_azure\_container\_apps\_hosting) | github.com/DFE-Digital/terraform-azurerm-container-apps-hosting | v1.6.1 | | [azurerm\_key\_vault](#module\_azurerm\_key\_vault) | github.com/DFE-Digital/terraform-azurerm-key-vault-tfvars | v0.4.1 | | [statuscake-tls-monitor](#module\_statuscake-tls-monitor) | github.com/dfe-digital/terraform-statuscake-tls-monitor | v0.1.3 | @@ -188,6 +188,7 @@ No resources. | [project\_name](#input\_project\_name) | Project name. Will be used along with `environment` as a prefix for all resources. | `string` | n/a | yes | | [registry\_admin\_enabled](#input\_registry\_admin\_enabled) | Do you want to enable access key based authentication for your Container Registry? | `bool` | `true` | no | | [registry\_managed\_identity\_assign\_role](#input\_registry\_managed\_identity\_assign\_role) | Assign the 'AcrPull' Role to the Container App User-Assigned Managed Identity. Note: If you do not have 'Microsoft.Authorization/roleAssignments/write' permission, you will need to manually assign the 'AcrPull' Role to the identity | `bool` | `false` | no | +| [registry\_server](#input\_registry\_server) | Container registry server | `string` | `""` | no | | [registry\_use\_managed\_identity](#input\_registry\_use\_managed\_identity) | Create a User-Assigned Managed Identity for the Container App. Note: If you do not have 'Microsoft.Authorization/roleAssignments/write' permission, you will need to manually assign the 'AcrPull' Role to the identity | `bool` | `true` | no | | [statuscake\_api\_token](#input\_statuscake\_api\_token) | API token for StatusCake | `string` | `"00000000000000000000000000000"` | no | | [statuscake\_contact\_group\_email\_addresses](#input\_statuscake\_contact\_group\_email\_addresses) | List of email address that should receive notifications from StatusCake | `list(string)` | `[]` | no | diff --git a/terraform/container-apps-hosting.tf b/terraform/container-apps-hosting.tf index 00e80d8c5..b3ac2805f 100644 --- a/terraform/container-apps-hosting.tf +++ b/terraform/container-apps-hosting.tf @@ -1,5 +1,5 @@ module "azure_container_apps_hosting" { - source = "github.com/DFE-Digital/terraform-azurerm-container-apps-hosting?ref=v1.5.1" + source = "github.com/DFE-Digital/terraform-azurerm-container-apps-hosting?ref=v1.6.1" environment = local.environment project_name = local.project_name @@ -9,6 +9,8 @@ module "azure_container_apps_hosting" { virtual_network_address_space = local.virtual_network_address_space enable_container_registry = local.enable_container_registry + image_name = local.image_name + registry_server = local.registry_server registry_admin_enabled = local.registry_admin_enabled registry_use_managed_identity = local.registry_use_managed_identity registry_managed_identity_assign_role = local.registry_managed_identity_assign_role @@ -23,7 +25,6 @@ module "azure_container_apps_hosting" { enable_logstash_consumer = local.enable_logstash_consumer eventhub_export_log_analytics_table_names = local.eventhub_export_log_analytics_table_names - image_name = local.image_name container_command = local.container_command container_secret_environment_variables = local.container_secret_environment_variables container_max_replicas = local.container_max_replicas diff --git a/terraform/locals.tf b/terraform/locals.tf index a1eb8aebd..644864177 100644 --- a/terraform/locals.tf +++ b/terraform/locals.tf @@ -5,10 +5,11 @@ locals { tags = var.tags virtual_network_address_space = var.virtual_network_address_space enable_container_registry = var.enable_container_registry + image_name = var.image_name + registry_server = var.registry_server registry_admin_enabled = var.registry_admin_enabled registry_use_managed_identity = var.registry_use_managed_identity registry_managed_identity_assign_role = var.registry_managed_identity_assign_role - image_name = var.image_name container_command = var.container_command container_secret_environment_variables = var.container_secret_environment_variables container_max_replicas = var.container_max_replicas diff --git a/terraform/variables.tf b/terraform/variables.tf index 030e3877b..2fc43c92b 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -38,6 +38,17 @@ variable "enable_container_registry" { type = bool } +variable "image_name" { + description = "Image name" + type = string +} + +variable "registry_server" { + description = "Container registry server" + type = string + default = "" +} + variable "registry_admin_enabled" { description = "Do you want to enable access key based authentication for your Container Registry?" type = bool @@ -56,11 +67,6 @@ variable "registry_managed_identity_assign_role" { default = false } -variable "image_name" { - description = "Image name" - type = string -} - variable "container_command" { description = "Container command" type = list(any)