Skip to content

Commit

Permalink
Add variables to allow changing registry
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Stretch96 committed Apr 15, 2024
1 parent bf9ac0d commit 542df3d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 59 deletions.
90 changes: 40 additions & 50 deletions terraform/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ No providers.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_azure_container_apps_hosting"></a> [azure\_container\_apps\_hosting](#module\_azure\_container\_apps\_hosting) | github.com/DFE-Digital/terraform-azurerm-container-apps-hosting | v1.5.1 |
| <a name="module_azure_container_apps_hosting"></a> [azure\_container\_apps\_hosting](#module\_azure\_container\_apps\_hosting) | github.com/DFE-Digital/terraform-azurerm-container-apps-hosting | v1.6.1 |
| <a name="module_azurerm_key_vault"></a> [azurerm\_key\_vault](#module\_azurerm\_key\_vault) | github.com/DFE-Digital/terraform-azurerm-key-vault-tfvars | v0.4.1 |
| <a name="module_statuscake-tls-monitor"></a> [statuscake-tls-monitor](#module\_statuscake-tls-monitor) | github.com/dfe-digital/terraform-statuscake-tls-monitor | v0.1.3 |

Expand Down Expand Up @@ -187,6 +187,7 @@ No resources.
| <a name="input_project_name"></a> [project\_name](#input\_project\_name) | Project name. Will be used along with `environment` as a prefix for all resources. | `string` | n/a | yes |
| <a name="input_registry_admin_enabled"></a> [registry\_admin\_enabled](#input\_registry\_admin\_enabled) | Do you want to enable access key based authentication for your Container Registry? | `bool` | `true` | no |
| <a name="input_registry_managed_identity_assign_role"></a> [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 |
| <a name="input_registry_server"></a> [registry\_server](#input\_registry\_server) | Container registry server | `string` | `""` | no |
| <a name="input_registry_use_managed_identity"></a> [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` | `false` | no |
| <a name="input_restrict_container_apps_to_cdn_inbound_only"></a> [restrict\_container\_apps\_to\_cdn\_inbound\_only](#input\_restrict\_container\_apps\_to\_cdn\_inbound\_only) | Restricts access to the Container Apps by creating a network security group that only allows 'AzureFrontDoor.Backend' inbound, and attaches it to the subnet of the container app environment. | `bool` | n/a | yes |
| <a name="input_statuscake_api_token"></a> [statuscake\_api\_token](#input\_statuscake\_api\_token) | API token for StatusCake | `string` | `"00000000000000000000000000000"` | no |
Expand Down
5 changes: 3 additions & 2 deletions terraform/container-apps-hosting.tf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,11 +9,12 @@ 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

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
Expand Down
3 changes: 2 additions & 1 deletion terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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_scale_http_concurrency = var.container_scale_http_concurrency
container_secret_environment_variables = var.container_secret_environment_variables
Expand Down
16 changes: 11 additions & 5 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 542df3d

Please sign in to comment.