Hey,
in our <span>pipeline </span>defintions we're trying to use a custom terraform module which is hosted in a private bitbucket cloud repository.
Our config looks like the following:
"bitbucket-pipelines.yml"
main:
- step: *build
- step:
name: Deploy to Staging
image: hashicorp/terraform:latest
deployment: Staging
script:
- echo "$BITBUCKET_SA" | base64 -d >> /tmp/gcloud.json
- export GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcloud.json
- cd terraform/
- terraform init -backend-config=./backend/file-for-backend..hcl
- terraform apply -auto-approve -var-file='./setup.tfvars' -var-file='./backend/file-for-vars.tfvars'
"terraform - main.tf"
module "cloud_function" {
source = "git::https://bitbucket.org/<company-workspace>/tfm-gcp.git//cloud_function"
for_each = var.functions
project_id = var.project_id
region = var.region
name = each.value.name
entry_point = each.value.entry_point
trigger_event = each.value.trigger_event
trigger_resource = each.value.trigger_resource
environment_variables = each.value.environment_variables
runtime = var.runtime
source_path = "../functions/"
permissions = ["roles/bigquery.dataEditor"]
}So no magic involed or substitions but while running the pipline we get the following
<span>Initializing modules...</span>
<span>Downloading git::https://$AZR_IMG_USERNAME.org/dmk-group/tfm-gcp.git for cloud_function...</span>
<span>╷</span>
<span>│</span> <span>Error: </span><span>Failed to download module</span>
<span>+ terraform init -backend-config=./backend/dspl-dev-fs.hcl</span>
<span>$AZR_IMG_USERNAME is the first variable defined in our workspace variables for pipelines but is not used within the repository or project... so it seems like a bug within the pipeline runtime or am I wrong?</span><span>It should just download the defined module, specified in main.tf, but theres an substitution with the word "bitbucket" in URL. </span>