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" | |
| } | |
| } | |
| } |
Author
Hey @rolandihms it may be related to this let's hope we can get some fixes there because ACA for me is an amazing product!
Cheers
Yeah @ilmax I am very impressed with ACA product offering.
Take care!
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!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @ilmax,
Thanks for the feedback, info and links. Will check out the sample repo. It looks like the containers are actually deployed but terraform times out somewhere and responds with "Operation Expired". Looks like its an issue on the Azure Rest API. AzApi.
I will destroy and start fresh to see if this is reproduced.
Eagerly waiting for the next version bump.
Thanks again, have a great day...
Cheers