Functioning Code Using Terraform
I am more familiar with Terraform, where I can do something like:
module "storagemod" {
source = "git::https://MyProj@dev.azure.com/MyProj/Dataplatform/_git/myrepo//storage-account?ref=v0.2.0"
rg_name = "MyRG"
resource_name = "mynewdatalake"
.
.
.
}
where the source
referenced above is a different repository of Terraform modules that I am referencing to create resources.
The repository is a private Azure repository (on Azure DevOps) that I am able to access because I have already established git credentials in a previous step of the pipeline:
steps:
- task: PowerShell@2
inputs:
targetType: inline
script: 'git config --global http.extraheader "AUTHORIZATION: bearer ${Env:SYSTEM_ACCESSTOKEN}"'
displayName: 'Setting Git Authentication header'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
How to Do This in Bicep?
How could I do something similar using Azure Bicep? We are trying to move over to Bicep.
I can do the same authentication of the Git headers, of course, but how can I handle the module?
Local
If it were local on the same repo, I could do:
module storagemod './storage/datalake.bicep' = {
name: 'createDataLakeAndContainers'
params: {
.
.
.
}
}
Separate Repo
Can I do something like this?
module storagemod 'git::https://MyProj@dev.azure.com/MyProj/Dataplatform/_git/myrepo//storage-account?ref=v0.2.0' = {
name: 'createDataLakeAndContainers'
params: {
.
.
.
}
}
I couldn't get that to work, but I was hoping that the capability is there and I just had the syntax wrong. I could not find any documentation on it.