実現したいこと
GitLab CI/CDを使ったTerraformを実行させたいが下記のエラーが出ております。
解決にご助力ください。
発生している問題・エラーメッセージ
パイプラインで実行した「Terraform plan」のデバッグ全てです。
Running with gitlab-runner 13.7.0 (943fc252) on shell-runner piBzsG8K Preparing the "docker" executor 00:05 Using Docker executor with image hashicorp/terraform:latest ... Pulling docker image hashicorp/terraform:latest ... Using docker image sha256:7de55dfbda43eafac5d7789dd3c2ded5764c217e8369f92b366ff295044e9276 for hashicorp/terraform:latest with digest docker.io/hashicorp/terraform@sha256:7b1e232f564132b949b812ee138249b5398bedf3c6fab42b468d4ec8acf5343c ... Preparing environment 00:01 Running on runner-pibzsg8k-project-2-concurrent-0 via ec-te-53... Getting source from Git repository 00:01 Fetching changes with git depth set to 50... Reinitialized existing Git repository in /builds/root/test/.git/ Checking out 78d5c5b2 as master... Removing .terraform.lock.hcl Removing .terraform/ Skipping Git submodules setup Executing "step_script" stage of the job script 00:01 $ terraform plan Warning: Version constraints inside provider configuration blocks are deprecated on variables.tf line 2, in provider "aws": 2: version = "~> 2.0" Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now deprecated and will be removed in a future version of Terraform. To silence this warning, move the provider version constraint into the required_providers block. Error: Could not load plugin Plugin reinitialization required. Please run "terraform init". Plugins are external binaries that Terraform uses to access and manipulate resources. The configuration provided requires plugins which can't be located, don't satisfy the version constraints, or are otherwise incompatible. Terraform automatically discovers provider requirements from your configuration, including providers used in child modules. To see the requirements and constraints, run "terraform providers". Failed to instantiate provider "registry.terraform.io/hashicorp/aws" to obtain schema: unknown provider "registry.terraform.io/hashicorp/aws" ERROR: Job failed: exit code 1
.gitlab-ci.ymlの中身
image: name: hashicorp/terraform:latest entrypoint: [""] stages: - init - plan stage1: stage: init script: - terraform init stage2: stage: plan script: - terraform plan
環境構築について
下記記事を参考にGitLab emとRunnerをインストールいたしました。
GitLabインストール方法
Runner登録方法
補足情報(FW/ツールのバージョンなど)
terraform --version
Terraform v0.14.3
- provider registry.terraform.io/hashicorp/aws v2.70.0
回答1件
あなたの回答
tips
プレビュー