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

No unique copy names for loops inside resources #13171

Closed
miqm opened this issue Feb 1, 2024 · 0 comments · Fixed by #15910
Closed

No unique copy names for loops inside resources #13171

miqm opened this issue Feb 1, 2024 · 0 comments · Fixed by #15910
Labels
bug Something isn't working Needs: Upvote This issue requires more votes to be considered Quality Sprint: Yes
Milestone

Comments

@miqm
Copy link
Collaborator

miqm commented Feb 1, 2024

Bicep version
0.24.24

Describe the bug
Following template results in error: Duplicate resource copy names are not allowed in templates using symbolic names.

resource aksWorkloadIdentityApp1 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
  name: '${_resourceName}-id-app1'
  location: location

  @batchSize(1)
  resource federation 'federatedIdentityCredentials' = [for item in serviceAccountsApp1: {
    name: 'federated-credentials-${item}'
    properties: {
      audiences: [ 'api://AzureADTokenExchange' ]
      issuer: _aksOidcIssuerProfileURL
      subject: 'system:serviceaccount:${configAks.namespace}:${item}'
    }
  }]
}

resource aksWorkloadIdentityApp2 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
  name: '${_resourceName}-id-app2'
  location: location

  @batchSize(1)
  resource fedaration 'federatedIdentityCredentials' = [for item in serviceAccountsApp2: {
    name: 'federated-credentials-${item}'
    properties: {
      audiences: [ 'api://AzureADTokenExchange' ]
      issuer: _aksOidcIssuerProfileURL
      subject: 'system:serviceaccount:${configAks.namespace}:${item}'
    }
  }]
}

To Reproduce
Problem is that in generated json, there are copy objects with this same name federation. using same symbolic names is not forbidden in bicep as they are nested under different symbolic names. codegen when creating loops should generate names taking into account entire "path" rather than just the last part.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs: Upvote This issue requires more votes to be considered Quality Sprint: Yes
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants