以下のソース定義は terraform モジュールで機能しますが、PAT TOKEN があります。ローカル VM と Azure Pipelines で正常に動作します。この質問は、terraform モジュールのソース定義を定義する方法に関するものですが、PAT TOKEN をハードコーディングする必要はありません。
コードの作業コピー:
source = "git::https://<PAT TOKEN>@<AZURE DEVOPS URL>/DefaultCollection/<Project Name>y/_git/terraform-modules//<sub directory>"
私は以下を試しました:
git::https://<AZURE DEVOPS URL>/DefaultCollection/<Project Name>/_git/terraform-modules.git//<sub directory>
それは私に以下のようなエラーを与えました:
"git::https://<AZURE DEVOPS URL>/DefaultCollection/<Project Name>/_git/terraform-modules":
error downloading
'https://<AZURE DEVOPS URL>/DefaultCollection/<Project Name>/_git/terraform-modules':
/usr/bin/git exited with 128: Cloning into
'.terraform/modules/resource_group'...
fatal: could not read Username for 'https://<AZURE DEVOPS URL>':
terminal prompts disabled
以下のように、ドメイン部分なしでユーザー名を追加しました。
source = "git::https://<USERNAMEM@<AZURE DEVOPS URL>/DefaultCollection/<PROJECT NAME>/_git/terraform-modules.git//compute"
以下のエラー:
"git::https://<USERNAME>@<AZURE DEVOPS>/DefaultCollection/<PROJECT>/_git/terraform-modules.git":
error downloading
'https://<USERNAME>@<AZURE DEVOPS>/DefaultCollection/<PROJECT>/_git/terraform-modules.git':
/usr/bin/git exited with 128: Cloning into '.terraform/modules/sql_vms'...
fatal: could not read Password for
'https://<USERNAME>@<AZURE DEVOPS>': terminal prompts disabled
ビルド パイプラインがユーザー名とパスワードを指定しなくてもチェックアウトできる場合、テラフォーム コードで言及する必要があるのはなぜですか。
Azure Pipeline Agent には git 資格情報があります。これが PAT トークンなしでまったく機能するかどうかわかりませんか?