-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for workload profiles in Terraform #21747
Comments
Currently only the plan with workload profiles work within an enterprise setting with ingress and egress limitations by the firewall. This feature is thus very desired by enterprise customers using Terraform on Azure. |
May I know if this is available yet in Terraform 3.x.x ? |
For my case, temporary workaround was to use resource "azapi_resource" "aca_env" {
for_each = { for aca_env in var.aca_envs : aca_env.name => aca_env}
type = "Microsoft.App/managedEnvironments@2022-11-01-preview"
name = each.value.name
parent_id = azurerm_resource_group.rg.id
location = each.value.location
tags = merge(var.default_tags, each.value.tags)
body = jsonencode({
properties = {
appLogsConfiguration = {
destination = "log-analytics"
logAnalyticsConfiguration = {
customerId = azurerm_log_analytics_workspace.law["${each.value.name}-law"].workspace_id
sharedKey = azurerm_log_analytics_workspace.law["${each.value.name}-law"].primary_shared_key
}
}
vnetConfiguration = {
"internal" = true
"infrastructureSubnetId" = data.azurerm_subnet.subnets[each.value.subnet_id].id
}
workloadProfiles = [
{
name = "Consumption"
workloadProfileType = "Consumption"
}
]
}
})
} |
Workload profiles has left preview and is now GA. |
Is there any update on this one, has work started, and is there a potential date by which this will be available? |
Enterprise customers are waiting on this! Do we have a statement by hashicorp? |
Same here... I'm considering a "ClickOps" approach for the CAE, and then referencing it as a data object until the desired attributes become available. |
@tlchaffi I converted our environment over to the AzApi approach but also had to update our container app creation to AzApi as well. Otherwise, you can't set the |
Gah, good call out. I didn't even think about that. You're right AzAPI is the only way to go right now. Any chance you'd be willing to share your AzAPI block for both the container app environment, and a container app? OpSec stuff redacted, of course. |
@tlchaffi hope this helps. Env resource "azapi_resource" "aca_env" {
type = "Microsoft.App/managedEnvironments@2022-11-01-preview"
schema_validation_enabled = false
name = "${var.project_abbreviation != "" ? substr(lower(var.project_abbreviation), 0, 4) : substr(lower(var.project), 0, 4)}-${lookup(var.environment_map, var.environment)}-${lookup(var.region_map, var.region)}-${var.instance}-cae"
parent_id = var.resource_group_id
location = var.region
tags = merge(local.tags, var.tags)
body = jsonencode({
properties = {
daprAIConnectionString = var.app_insights_connection_string
appLogsConfiguration = {
destination = "log-analytics"
logAnalyticsConfiguration = {
customerId = var.log_analytics_workspace_customer_id
sharedKey = var.log_analytics_workspace_primary_shared_key
}
}
vnetConfiguration = {
"internal" = false
"infrastructureSubnetId" = var.infrastructure_subnet_id
}
workloadProfiles = [
{
name = "Consumption"
workloadProfileType = "Consumption"
}
]
}
})
} Container App resource "azapi_resource" "container_app" {
type = "Microsoft.App/containerApps@2022-11-01-preview"
schema_validation_enabled = false
name = "${local.name}-ca-${var.container_name}"
location = var.region
parent_id = var.resource_group_id
tags = merge(local.tags, var.tags)
identity {
type = var.user_identity_resource_id == "" ? "SystemAssigned" : "SystemAssigned, UserAssigned"
identity_ids = var.user_identity_resource_id == "" ? [] : [var.user_identity_resource_id]
}
body = jsonencode({
properties = {
environmentId = var.container_app_environment_id
configuration = {
activeRevisionsMode = var.revision_mode
dapr = var.dapr != null ? {
appId = var.dapr.app_id
appPort = var.dapr.app_port
appProtocol = var.dapr.app_protocol
} : null
ingress = var.ingress != null ? {
allowInsecure = var.ingress.allow_insecure_connections
external = var.ingress.external_enabled
targetPort = var.ingress.target_port
transport = var.ingress.transport
} : null
registries = var.registry != null ? [{
server = var.registry.server
identity = var.registry.identity
}] : []
}
workloadProfileName = "Consumption"
template = {
scale = {
minReplicas = var.min_replicas
maxReplicas = var.max_replicas
}
containers = [{
name = "${local.name}-ca-${var.container_name}"
env = [for k, v in var.env_variables : {
name = k
value = v.value
}]
image = var.container_image
probes = var.ingress != null ? [{
httpGet = {
port = var.liveness_probe.port
path = var.liveness_probe.path
}
type = "Liveness"
}, {
httpGet = {
port = var.startup_probe.port
path = var.startup_probe.path
}
type = "Startup"
}] : []
resources = {
cpu = lookup(var.resource_map, var.resources)[0]
memory = lookup(var.resource_map, var.resources)[1]
}
}]
}
}
})
response_export_values = ["identity"]
} |
@jsheetzmt thank you! I sincerely appreciate this! |
@mybayern1974 please remove the preview tag, so we can get this done |
@jsheetzmt thank you for your comment - I want to create a container app environment [ Workloads Profile ] and a container app that uses a managed identity to pull images from ACR. My Container app environment code works but when I try to create a container app - it fails with a error that says that the managed identity is unable to pull images from ACR. I don't know if the error means to say that there's something wrong with my azapi resource block. Does anyone has any idea why this is failing? My CAE block :
Here's my container app block :
This is the error I am getting :
I have assigned my user-assigned managed identity ACRpull role on the subscription. |
@ZarakiKenpachi7 did you check RBAC permissions (ACR Pull) on the managed identity? |
@RSwarnkar yes, my uami has ACRpull on the subscription level. |
tbh...sometimes i think its just better to use python + azcli than terraform. |
Alright, found the issue - my dns A records were pointing to the wrong fqdn. DNS Resolution was the issue while calling the image. |
Then you remember the dependency tree hell you can get the into
…On Thu, 5 Oct 2023, 23:28 dss010101, ***@***.***> wrote:
tbh...sometimes i think its just better to use python + azcli than
terraform.
—
Reply to this email directly, view it on GitHub
<#21747 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADE23XNO4YJXLPE4XFZDHTDX54X7TAVCNFSM6AAAAAAX5DOH5WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBZG42DCNZUGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
Could we remove the preview tag in order to have this implemented please? |
This comment was marked as off-topic.
This comment was marked as off-topic.
Any update please ? |
Closed by #23478 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Is there an existing issue for this?
Community Note
Description
Workload profiles are in preview as part of the Consumption + Dedicated plan structure. It would helpful to create and manage workload profiles using Terraform
New or Affected Resource(s)/Data Source(s)
azurerm_container_app_environment
Potential Terraform Configuration
No response
References
No response
The text was updated successfully, but these errors were encountered: