0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Terrafomeバージョンアップ手順

Posted at

Terraform および Terraform Providerのバージョンを更新する必要があったので、手順を残します。

更新内容

terraform {
- required_version = "~> 1.2.0"
+ required_version = "~> 1.11.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
-     version = "~> 4.19.0"
+     version = "~> 5.94.0"
    }
  }
  backend "s3" {}
}

Terraformバージョンを更新

required_versionを書き換えて、次のコマンドを実行する。

% terraform init -reconfigure -backend-config="profile=MY_PROFILE" -backend-config=../../tfvars/STAGE.tfbackend

Terraform Providerのバージョンを更新

required_providersversionを書き換えて、次のコマンドを実行する。

terraform init -upgrade -backend-config="profile=MY_PROFILE" -backend-config=../../tfvars/STAGE.tfbackend

注意として、required_providersが複数存在する場合、バージョンが異なると次のエラーが表示された(1敗)。

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/aws: no available releases match the given constraints ~> 4.19.0, ~> 5.94.0

To see which modules are currently depending on hashicorp/aws and what versions are specified, run the following command:
    terraform providers

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?