hashicorp / hashicorp/setup-terraform

Terraform init with Azure DevOps and https for module source

Open
#223 38 comments 15 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
288
Avg merge
23h 21m
Merged PRs (30d)
3

Description

So, we are using Azure Devops to store our Terraform config and all the self created module code.
We also want to use a DevOps Pipeline to apply the configuration.

As we are not allowed to use ssh for accessing the repos (traffic has to go trough the https-proxy), so we have to use https for the repository integration so that our source for the module looks like
```
source = "git::https://<>@dev.azure.com/>/<>>/_git/<>"
```

Locally running `terraform init` works completely fine. When running it in the pipeline we see following

```
│ Error: Failed to download module

│ Could not download module "xyz" (main.tf:3)
│ source code from
│ "git::https://<>@dev.azure.com/>/<>>/_git/<>"
│ error downloading
│ 'https://<>@dev.azure.com/>/<>>/_git/<>'
│ /usr/bin/git exited with 128: Cloning into
│ '.terraform/modules/xyz'...
│ fatal: could not read Password for 'https://<>@dev.azure.com':
│ terminal prompts disabled
```

We have tested many things right now and only with changeing source to
```
source = "git::https://<>@dev.azure.com/>/<>>/_git/<>"
```

we were able to run `terraform init` but checking in PAT to git sounds not very right.

Anyone an idea on that?
Regards
Joerg

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the module source at main.tf:3 and reproduce the pipeline failure by running terraform init with the HTTPS Git URL shown in the issue. Compare the pipeline's Git authentication behavior with the successful local run; done means the module downloads through the HTTPS proxy without putting a PAT in the source URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.