Search code examples
gitazure-devopsterraformazure-data-factoryazure-bicep

Data Factory repoConfiguration in Bicep - lastCommitId


I have been working with bicep for a short time and have the following problem.

I make bicep deplyoment for an already existeirende Data Factory (Connected with Git). I have configured it as follows:

resource name_resource 'Microsoft.DataFactory/factories@2018-06-01' {
  name: 'adf-...'
  location: location
  properties: {
    publicNetworkAccess: 'Enabled'
    repoConfiguration: isDEV ? {
      accountName: '...'
      repositoryName: '...'
      disablePublish: false
      collaborationBranch: '...'
      rootFolder: '...'
      type: 'FactoryVSTSConfiguration'
      lastCommitId:
      projectName: '...'
      tenantId: subscription().tenantId
      } : null 
  }
  tags: tags
  identity: {
    type: 'SystemAssigned'
  }
}

Everything looks good except lastCommitId.

If I do not configure it, it will be deleted according to Bicep What-if (logical).

I can't hardcode it because the commitId changes with every adf-publish.

Is there a way to dynamically read lastCommitId and pass it to the bicep deplyoment?

Something like with output? I have tried myself, but unfortunately I can't get any further.

lastCommitId: id

output id string = name_resource.properties.repoConfiguration.lastCommitId

ERROR
The expression is involved in a cycle ("id" -> "name_resource").

I am grateful for any advice.


Solution

  • Unfortunately, I haven't found a way to solve it directly in the bicep. But I have a workaround, you can read it dynamically during the deployment, in the deplyoment pipeline. Here is a link to it:

    Parse Set variables output to template - Azure yml pipeline