Last active
November 25, 2022 15:41
-
-
Save ilmax/11817b6c0e00df9237ae54e2c5fcef84 to your computer and use it in GitHub Desktop.
azapi terraform provider configuration
This file contains hidden or 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
| resource "azapi_resource" "aca-test-environment" { | |
| name = "aca-test-environment" | |
| type = "Microsoft.App/managedEnvironments@2022-03-01" | |
| location = var.location | |
| parent_id = azurerm_resource_group.aca-test-rg.id | |
| body = jsonencode({ | |
| properties = { | |
| appLogsConfiguration = { | |
| destination = "log-analytics" | |
| logAnalyticsConfiguration = { | |
| customerId = azurerm_log_analytics_workspace.aca-test-ws.workspace_id | |
| sharedKey = azurerm_log_analytics_workspace.aca-test-ws.primary_shared_key | |
| } | |
| } | |
| } | |
| }) | |
| } | |
| resource "azapi_resource" "producer_container_app" { | |
| name = "producer-containerapp" | |
| location = var.location | |
| parent_id = azurerm_resource_group.aca-test-rg.id | |
| type = "Microsoft.App/containerApps@2022-03-01" | |
| body = jsonencode({ | |
| properties = { | |
| managedEnvironmentId = azapi_resource.aca-test-environment.id | |
| configuration = { | |
| ingress = { | |
| targetPort = 80 | |
| external = true | |
| }, | |
| registries = [ | |
| { | |
| server = azurerm_container_registry.aca-test-registry.login_server | |
| username = azurerm_container_registry.aca-test-registry.admin_username | |
| passwordSecretRef = "registry-password" | |
| } | |
| ], | |
| secrets : [ | |
| { | |
| name = "registry-password" | |
| # Todo: Container apps does not yet support Managed Identity connection to ACR | |
| value = azurerm_container_registry.aca-test-registry.admin_password | |
| } | |
| ] | |
| }, | |
| template = { | |
| containers = [ | |
| { | |
| image = "${azurerm_container_registry.aca-test-registry.login_server}/${var.producer_image_name}:latest" | |
| name = "producer", | |
| env : [ | |
| { | |
| "name" : "EnvVariable", | |
| "value" : "Value" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| } | |
| }) | |
| # This seems to be important for the private registry to work(?) | |
| ignore_missing_property = true | |
| response_export_values = ["properties.configuration.ingress"] | |
| } |
This file contains hidden or 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
| terraform { | |
| required_providers { | |
| azurerm = { | |
| source = "hashicorp/azurerm" | |
| version = "~> 3.7.0" | |
| } | |
| azapi = { | |
| source = "Azure/azapi" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally got back full control of the infra 💥. complete destroy and fresh deploy did the trick and sorted the ACR issue that led me here in the first place.🤦♂️
Thanks again!