Hello,
I have created a gitlab pipeline following the document “terraspace.cloud/docs/ci/gitlab/push/.” I have added the following variables in the Gitlab
ARM_SUBSCRIPTION_ID, ARM_CLIENT_ID, ARM_CLIENT_SECRET, ARM_TENANT_ID and ARM_LOCATION
but my pipeline failing with the following error
terraspace plan vnet: Exception Armrest::Error: #Net::HTTPUnauthorized:0x00007f215e9a5ca0
Error running: terraspace plan vnet Fix the error above or check logs for the error.
Adding my .gitlab-ci.yaml file
image: ruby:latest
stages:
- up dev
# ...
before_script: |
# install terraform
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
export PATH="$HOME/.tfenv/bin:$PATH"
tfenv install latest
tfenv use latest
terraform --version
# install terraspace
bundle
bundle exec terraspace new shim
echo 'export PATH="/usr/local/bin:$PATH' >> ~/.bash_profile
export PATH="/usr/local/bin:$PATH"
bundle update terraspace
up_dev:
stage: up dev
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"'
script:
- TF_ENV="lab" terraspace all plan
I think it is because the pipeline is not able to fetch the credentials. Also, I have added gem "terraspace_plugin_azurerm"
in the Gemfile. Any help will be much appreciated. Thanks