I am trying to use a Private Terraform Module Hosted on Bitbucket in GitHub Actions. But am getting the below error . What am I doing wrong?
/home/runner/work/_temp/b5ffd751-d41c-44d0-9df7-27542c871716/terraform-bin init
Initializing the backend...
Initializing modules...
╷
│ Error: Invalid module source address
│
│ on main.tf line 3, in module "lulapay_infrastructue":
│ 3: source = "git::https://<BITBUCKET_USERNAME>:<BITBUCKET_APP_PASSWORD>@bitbucket.org/lulalend/terraform-lula-infrastructure//terraform/stacks/lulapay"
│
│ Terraform failed to determine your intended installation method for remote
│ module package
│ "https://<BITBUCKET_USERNAME>:<BITBUCKET_APP_PASSWORD>@bitbucket.org/lulalend/terraform-lula-infrastructure".
│
│ If you intended this as a path relative to the current module, use
│ "./https://<BITBUCKET_USERNAME>:<BITBUCKET_APP_PASSWORD>@bitbucket.org/lulalend/terraform-lula-infrastructure"
│ instead. The "./" prefix indicates that the address is a relative
│ filesystem path.
main.tf
module "lulapay_infrastructue" {
source = "git::https://<BITBUCKET_USERNAME>:<BITBUCKET_APP_PASSWORD>@bitbucket.org/lulalend/terraform-lula-infrastructure//terraform/stacks/lulapay"
# other module inputs
}
Workflow:
name: Apply Terraform with Private Bitbucket Module
on:
push:
branches:
- feature/** # Apply Terraform on feature branches
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.8.5 # Specify the required Terraform version
- name: Initialize Terraform
working-directory: ./terraform/
run: terraform init
env:
BITBUCKET_USERNAME: ${{ secrets.BITBUCKET_USERNAME }}
BITBUCKET_APP_PASSWORD: ${{ secrets.BITBUCKET_APP_PASSWORD }}
- name: Terraform Plan
working-directory: ./terraform/
run: terraform plan
env:
BITBUCKET_USERNAME: ${{ secrets.BITBUCKET_USERNAME }}
BITBUCKET_APP_PASSWORD: ${{ secrets.BITBUCKET_APP_PASSWORD }}
- name: Terraform Apply
working-directory: ./terraform/
run: terraform apply -auto-approve
env:
BITBUCKET_USERNAME: ${{ secrets.BITBUCKET_USERNAME }}
BITBUCKET_APP_PASSWORD: ${{ secrets.BITBUCKET_APP_PASSWORD }}
Recognized by CI/CD Collective
1