Container App Environment module can deploy these resources:
- azurerm_container_app_environment (required)
- azurerm_monitor_diagnostic_setting (optional)
Example variables structure is located in variables.md.
Example use case is located in test-case/locals.tf.
You can also see changelog.
Terraform documentation:
WARNING: AzureRM provider had been updated to a new major version. Many breaking changes were implemented. See the providers guide for more information.
There are a few things you need to do to import resources into .tfstate. In the example below there are resources which can be imported within the module. You may need to modify these commands to the OS on which they will be running (Refer to the documentation for additional details).
- terraform import '
<path-to-module>
.azurerm_container_app_environment.container_app_environment["<container-app-environment-name>
"]' '/subscriptions/<subscription-id>
/resourceGroups/<resource-group-name>
/providers/Microsoft.App/managedEnvironments/<container-app-environment-name>
'
- terraform import '
<path-to-module>
.azurerm_monitor_diagnostic_setting.diagnostic_setting["<container-app-environment-name>
_<diag-name>
"]' '/subscriptions/<subscription-id>
/resourceGroups/<resource-group-name>
/providers/Microsoft.App/managedEnvironments/<container-app-environment-name>
|<diag-name>
'
NOTE:
<path-to-module>
is terraform logical path from root. e.g. module.container_app_environment
Output Name | Value | Comment |
---|---|---|
outputs | name | |
id | ||
default_domain | Default, publicly resolvable name of deployed CAE | |
static_ip_address | Static IP address of deployed CAE |
In the example below, outputted id of the deployed Container App Environment module is used as a value for the scope variable in Role Assignment resource.
module "cae" {
source = "git@github.com:Seyfor-CSC/mit.container-app-environment.git?ref=v1.0.0"
config = [
{
name = "SEYTERRAFORMNECAE01"
location = "northeurope"
resource_group_name = "SEY-TERRAFORM-NE-RG01"
}
]
}
data "azurerm_client_config" "azurerm_client_config" {
}
resource "azurerm_role_assignment" "role_assignment" {
scope = module.cae.outputs.seyterraformnecae01.id # This is how to use output values
role_definition_name = "Contributor"
principal_id = data.azurerm_client_config.azurerm_client_config.object_id
}
No special features in module.
maximum_count
and minimum_count
variables in the workload_profile
object variable are optional as they can't be set to any value when workload_profile_type = "Consumption"
.