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

front door rule #2200

Open
1 task done
vc2023 opened this issue Jun 21, 2024 · 0 comments
Open
1 task done

front door rule #2200

vc2023 opened this issue Jun 21, 2024 · 0 comments

Comments

@vc2023
Copy link

vc2023 commented Jun 21, 2024

Resource Type

Microsoft.Cdn/profiles/ruleSets

Api Version

2023-05-01

Issue Type

Resource fails to deploy

Other Notes

I'm trying to deploy a rule belonging to a rule set, which in turn belongs to a front door profile as a separate bicep module.
but I get the following error

Deployment template validation failed: 'The template resource '[format('{0}/{1}/{2}', split(parameters('ruleSetName'), '/')[0], split(parameters('ruleSetName'), '/')[1], parameters('name'))]' at line '1' and column '1216' is not valid: The language expression property array index '1' is out of bounds.. Please see https://aka.ms/arm-functions for usage details.'. (Code: InvalidTemplate)

Bicep Repro

frontdoor-rule-set.bicep

param name string
param profileName string

resource frontDoor 'Microsoft.Cdn/profiles@2021-06-01' existing = {
  name:profileName
}
resource ruleSet 'Microsoft.Cdn/profiles/ruleSets@2023-05-01' = {
  name: name
  parent: frontDoor
}

output name string = ruleSet.name

frontdoor-rule.bicep

param ruleSetName string
param name string
param action object
param condition object

resource ruleSet 'Microsoft.Cdn/profiles/ruleSets@2023-05-01' existing = {
  name: ruleSetName
}

resource rule 'Microsoft.Cdn/profiles/ruleSets/rules@2023-05-01' = {
  name: name
  parent: ruleSet
  properties: {
    actions: [
      action
    ]
    conditions: [
      condition
    ]
  }
}

mani.bicep

module ruleSet 'services/frontdoor-rule-set.bicep' = {
  name:'fd-rs-${envName}'
  params:{
    name:frontDoorRulSetName
    profileName:frontDoorProfile.outputs.name
  }
}

module rule 'services/frontdoor-rule.bicep' = {
  name:'fd-rule-${envName}'
  params:{
    name:frontDoorRuleName
    ruleSetName:ruleSet.outputs.name
    action: {
      name: 'RouteConfigurationOverride'
      parameters: {
        originGroupOverride: {
          forwardingProtocol: 'MatchRequest'
          originGroup: {
            id: graphicDownloadRoute.outputs.originGroupId
          }
        }
        typeName: 'DeliveryRuleRouteConfigurationOverrideActionParameters'
      }
    }
    condition: {
      name: 'UrlPath'
      parameters: {
        matchValues: [
          'hashcode'
          'sas'
          'systeminfos'
        ]
        negateCondition: false
        operator: 'Contains'
        transforms: [
          'Lowercase'
        ]
        typeName: 'DeliveryRuleUrlPathMatchConditionParameters'
      }
    }
  }
}

Confirm

  • I have read the troubleshooting guide and looked for duplicates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant