Closed4
mrolla/circleci を利用した terraform init が失敗するのを追うScrap
CircleCIの環境変数を terraform で設定したいため、mrolla/circleci を利用している
AWS の S3 に tfstate を保存するように調整して terraform init をやり直したところ、
以下のようなエラーとなった・・
コンソール出力
❯ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
- Reusing previous version of mrolla/circleci from the dependency lock file
- Finding latest version of hashicorp/circle...
- Installing hashicorp/aws v4.22.0...
- Installed hashicorp/aws v4.22.0 (signed by HashiCorp)
- Using previously-installed mrolla/circleci v0.6.1
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/circle: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/circle
│
│ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on hashicorp/circle, run the following
│ command:
│ terraform providers
どうしてー?というのと、
hashicorp/circle って何すか?
というのを追う。
関連コード
(抜粋、かつ一部伏せてます)
main.tf
terraform {
required_providers {
circleci = {
source = "mrolla/circleci"
version = "0.6.1"
}
# aws = {
# source = "hashicorp/aws"
# }
}
# backend "s3" {
# bucket = "XXXXXX-tf-store"
# key = "path/to/terraform.tfstate"
# encrypt = true
# region = "ap-XXXXXXXX-1"
# profile = "default"
# }
}
resource circleci_environment_variable "docker_login" {
project = var.circleci_project_name
name = "DOCKER_LOGIN"
value = var.docker_login
}
resource circleci_environment_variable "docker_pwd" {
project = var.circleci_project_name
name = "DOCKER_PWD"
value = var.docker_pwd
}
# resource circle_environment_variable "aws_default_region" {
# project = var.circleci_project_name
# name = "AWS_DEFAULT_REGION"
# value = var.aws_default_region
# }
variables.tf
variable circleci_organization {}
variable circleci_project_name {}
variable circleci_token {}
variable docker_login {}
variable docker_pwd {}
variable aws_default_region {}
# variable aws_default_region {
# type = string
# default = "ap-XXXXXXXX-1"
# }
# variable "profile" {
# type = string
# default = "default"
# }
# variable "region" {
# type = string
# default = "ap-XXXXXXXX-1"
# }
# variable "aws_access_key" {}
# variable "aws_secret_key" {}
[補足]
.terrafomr-verion で 1.2.4 に固定している
このスクラップは2022/07/08にクローズされました