Skip to content
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

Microsoft.MachineLearningServices/workspaces/outboundRules updates rules sequentially #720

Open
prise6 opened this issue Jan 13, 2025 · 1 comment

Comments

@prise6
Copy link

prise6 commented Jan 13, 2025

Hello,
When using multiple Microsoft.MachineLearningServices/workspaces/outboundRules, each rule update the firewall sequentially and it's very slow and long.

Is it planned to have a collection ressource to update managed firewall once ?

@hqhqhqhqhqhqhqhqhqhqhq
Copy link
Collaborator

hqhqhqhqhqhqhqhqhqhqhq commented Jan 20, 2025

Hi @prise6 , thanks for raising this, you can refer to below script to bulk add outbound rules:

  variable "allowed_outbound_fqdns" {
    description = "List of FQDNs to allow outbound traffic to"
    type        = list(string)
    default     = ["example1.com", "example2.com", "example3.com", "example4.com"]
  }
 
  locals {
    transformed_fqdns = {
      for fqdn in var.allowed_outbound_fqdns : fqdn => substr(replace(fqdn, "/[^A-Za-z0-9]+/", ""), 0, 32)
    }
  }
 
  resource "azapi_update_resource" "ml_workspace_update" {
    type        = "Microsoft.MachineLearningServices/workspaces@2024-04-01"
    resource_id = azurerm_machine_learning_workspace.ml_workspace.id
 
    body = {
      properties = {
        managedNetwork = {
          // outboundRules is a map of RuleName to RuleObject
          outboundRules = {
            for fqdn, transformed_fqdn in local.transformed_fqdns : transformed_fqdn => {
              category    = "UserDefined"
              status      = "Active"
              type        = "FQDN"
              destination = fqdn
            }
          }
        }
      }
    }
  }

Support for this in azurerm provider should be under development now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants