-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass a map of apps to create on the service plan. BREAKING CHANGE: remove variable `app_name` BREAKING CHANGE: remove variable `auth_settings_enabled` BREAKING CHANGE: remove variable `aad_client_id` BREAKING CHANGE: remove variable `aad_client_secret_setting_name` BREAKING CHANGE: remove variable `acr_managed_identity_client_id` BREAKING CHANGE: remove variable `managed_identity_ids` BREAKING CHANGE: remove variable `custom_hostnames` BREAKING CHANGE: remove output `app_id` BREAKING CHANGE: remove output `app_name` BREAKING CHANGE: remove output `aad_client_secret_setting_name` BREAKING CHANGE: remove output `identity_principal_id` BREAKING CHANGE: remove output `identity_tenant_id` Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7dd94e0
commit 71ea3eb
Showing
13 changed files
with
292 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Azure Linux Web App Terraform sub-module | ||
|
||
Terraform sub-module which creates an Azure Linux Web App. | ||
|
||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | n/a | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [azurerm_app_service_certificate_binding.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_certificate_binding) | resource | | ||
| [azurerm_app_service_custom_hostname_binding.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_custom_hostname_binding) | resource | | ||
| [azurerm_app_service_managed_certificate.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_managed_certificate) | resource | | ||
| [azurerm_linux_web_app.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_web_app) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_aad_client_id"></a> [aad\_client\_id](#input\_aad\_client\_id) | The client ID of the App Registration to use for Azure AD authentication. | `string` | n/a | yes | | ||
| <a name="input_aad_client_secret_setting_name"></a> [aad\_client\_secret\_setting\_name](#input\_aad\_client\_secret\_setting\_name) | The name of the app setting where the client secret of the App Registration to use for Azure AD authentication must be stored. | `string` | `"AAD_CLIENT_SECRET"` | no | | ||
| <a name="input_acr_managed_identity_client_id"></a> [acr\_managed\_identity\_client\_id](#input\_acr\_managed\_identity\_client\_id) | The client ID of the Managed Identity that will be used to pull from the Container Registry. | `string` | `null` | no | | ||
| <a name="input_auth_settings_enabled"></a> [auth\_settings\_enabled](#input\_auth\_settings\_enabled) | Should authentication be enabled for this Linux Web App? | `bool` | `true` | no | | ||
| <a name="input_custom_hostnames"></a> [custom\_hostnames](#input\_custom\_hostnames) | A list of custom hostnames to bind to this Linux Web App. | `list(string)` | `[]` | no | | ||
| <a name="input_location"></a> [location](#input\_location) | The location to create the resources in. | `string` | n/a | yes | | ||
| <a name="input_managed_identity_ids"></a> [managed\_identity\_ids](#input\_managed\_identity\_ids) | The IDs of the Managed Identities to assign to this Linux Web App. | `list(string)` | `[]` | no | | ||
| <a name="input_name"></a> [name](#input\_name) | The name of this Linux Web App. | `string` | `null` | no | | ||
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The name of the resource group to create the resources in. | `string` | n/a | yes | | ||
| <a name="input_service_plan_id"></a> [service\_plan\_id](#input\_service\_plan\_id) | The ID of the service plan to create this Linux Web App for. | `string` | n/a | yes | | ||
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources. | `map(string)` | `{}` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_aad_client_secret_setting_name"></a> [aad\_client\_secret\_setting\_name](#output\_aad\_client\_secret\_setting\_name) | The name of the app setting that contains the client secret of the App Registration to use for Azure AD authentication. | | ||
| <a name="output_id"></a> [id](#output\_id) | The ID of this Linux Web App. | | ||
| <a name="output_identity_principal_id"></a> [identity\_principal\_id](#output\_identity\_principal\_id) | The principal ID of the system-assigned identity of this Linux Web App. | | ||
| <a name="output_identity_tenant_id"></a> [identity\_tenant\_id](#output\_identity\_tenant\_id) | The tenant ID of the system-assigned identity of this Linux Web App. | | ||
| <a name="output_name"></a> [name](#output\_name) | The name of this Linux Web App. | | ||
<!-- END_TF_DOCS --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
resource "azurerm_linux_web_app" "this" { | ||
name = var.name | ||
location = var.location | ||
resource_group_name = var.resource_group_name | ||
service_plan_id = var.service_plan_id | ||
|
||
https_only = true | ||
|
||
# App settings should be configured during deployment | ||
app_settings = null | ||
|
||
tags = var.tags | ||
|
||
auth_settings { | ||
enabled = var.auth_settings_enabled | ||
token_store_enabled = true | ||
|
||
active_directory { | ||
client_id = var.aad_client_id | ||
client_secret_setting_name = var.aad_client_secret_setting_name | ||
} | ||
} | ||
|
||
site_config { | ||
container_registry_use_managed_identity = var.acr_managed_identity_client_id != null ? true : false | ||
container_registry_managed_identity_client_id = var.acr_managed_identity_client_id | ||
} | ||
|
||
identity { | ||
type = length(var.managed_identity_ids) > 0 ? "SystemAssigned, UserAssigned" : "SystemAssigned" | ||
identity_ids = var.managed_identity_ids | ||
} | ||
} | ||
|
||
# Create a custom hostname binding for each custom hostname | ||
resource "azurerm_app_service_custom_hostname_binding" "this" { | ||
for_each = toset(var.custom_hostnames) | ||
|
||
hostname = each.value | ||
app_service_name = azurerm_linux_web_app.this.name | ||
resource_group_name = var.resource_group_name | ||
} | ||
|
||
# Create a managed certificate for each custom hostname binding | ||
resource "azurerm_app_service_managed_certificate" "this" { | ||
for_each = azurerm_app_service_custom_hostname_binding.this | ||
|
||
custom_hostname_binding_id = each.value.id | ||
} | ||
|
||
# Create a certificate binding for each managed certificate | ||
resource "azurerm_app_service_certificate_binding" "this" { | ||
for_each = azurerm_app_service_managed_certificate.this | ||
|
||
hostname_binding_id = each.value.custom_hostname_binding_id | ||
certificate_id = each.value.id | ||
ssl_state = "SniEnabled" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
output "id" { | ||
description = "The ID of this Linux Web App." | ||
value = azurerm_linux_web_app.this.id | ||
} | ||
|
||
output "name" { | ||
description = "The name of this Linux Web App." | ||
value = azurerm_linux_web_app.this.name | ||
} | ||
|
||
output "aad_client_secret_setting_name" { | ||
description = "The name of the app setting that contains the client secret of the App Registration to use for Azure AD authentication." | ||
value = azurerm_linux_web_app.this.auth_settings[0].active_directory[0].client_secret_setting_name | ||
} | ||
|
||
output "identity_principal_id" { | ||
description = "The principal ID of the system-assigned identity of this Linux Web App." | ||
value = azurerm_linux_web_app.this.identity[0].principal_id | ||
} | ||
|
||
output "identity_tenant_id" { | ||
description = "The tenant ID of the system-assigned identity of this Linux Web App." | ||
value = azurerm_linux_web_app.this.identity[0].tenant_id | ||
} |
Oops, something went wrong.