Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Bitbucket Pipeline replaces word "bitbucket" within url with variable



in our pipeline 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:



- step: *build

- step:

name: Deploy to Staging

image: hashicorp/terraform:latest

deployment: Staging


- 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 -"

module "cloud_function" {

source = "git::<company-workspace>/tfm-gcp.git//cloud_function"

for_each = var.functions

project_id = var.project_id

region = var.region

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 
+ terraform init -backend-config=./backend/dspl-dev-fs.hcl

Initializing modules...

Downloading git::https://$ for cloud_function...

Error: Failed to download module

$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?
It should just download the defined module, specified in, but theres an substitution with the word "bitbucket" in URL. 

1 answer

0 votes
Patrik S Atlassian Team Jun 23, 2022

Hello @hemp0r ,

Thank you for reaching out to Atlassian Community!

What I think might be happening here is that your workspace variable  $AZR_IMG_USERNAME is configured as a secure variable and the value of this variable is most likely bitbucketSince secure variables are masked from the pipeline build logs, if a value matching a secured variable appears in the logs (in this case bitbucket), Pipelines will replace it with $VARIABLE_NAME. The value your script/terraform will see is the actual value for the variable, but it will not be revealed in the logs.

Even though you are not directly using the variable in this repository, all the workspace variables are made available to the build container, and in the run time if we find any value in the logs matching a secure variable, it will be masked with the variable name.

Hope that helps to clarify your questions! Let me know in case you have any doubt.

Thank you, @hemp0r .

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,097 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you