terraform-aws-tfstate-backend icon indicating copy to clipboard operation
terraform-aws-tfstate-backend copied to clipboard

No compatibility with terraform v1.6

Open bigwheel opened this issue 2 years ago • 1 comments

Describe the Bug

With terraform v1.6, following error occurs in terraform plan:

╷
│ Warning: Deprecated Parameters
│ 
│   on backend.tf line 4, in terraform:
│    4:   backend "s3" {
│ 
│ The following parameters have been deprecated. Replace them as follows:
│   * role_arn -> assume_role.role_arn
│ 
╵

╷
│ Error: Cannot assume IAM Role
│ 
│ IAM Role ARN not set
╵

module

module "terraform_state_backend" {
  source  = "cloudposse/tfstate-backend/aws"
  version = "v1.1.1"

  namespace  = "piyo-dx"
  stage      = "development-tenant"
  name       = "azuread"
  attributes = ["tfstate"]

  terraform_backend_config_file_path = "."
  terraform_backend_config_file_name = "backend.tf"
}

Generated backend.tf

terraform {
  required_version = ">= 1.0.0"

  backend "s3" {
    region         = "ap-northeast-1"
    bucket         = "piyo-dx-development-tenant-azuread-tfstate"
    key            = "terraform.tfstate"
    dynamodb_table = "piyo-dx-development-tenant-azuread-tfstate-lock"
    profile        = ""
    role_arn       = ""
    encrypt        = "true"
  }
}

Expected Behavior

terraform plan success.

Steps to Reproduce

With terraform v1.6 and following configuration:

module "terraform_state_backend" {
  source  = "cloudposse/tfstate-backend/aws"
  version = "v1.1.1"

  namespace  = "hogehoge"
  stage      = "development"
  name       = "fugafuga"
  attributes = ["tfstate"]

  terraform_backend_config_file_path = "."
  terraform_backend_config_file_name = "backend.tf"
}

Screenshots

スクリーンショット 2023-10-05 8 37 41

Environment

  • OS: Mac os 14
  • terraform version: v1.6.0
  • module: v1.1.1

Additional Context

backend syntax was changed from v1.6 ( https://github.com/hashicorp/terraform/releases/tag/v1.6.0 ). It seems like that role_arn need to be nested.

P.S.

Thank you as always for this module. Our work has become simpler and more beautiful.

bigwheel avatar Oct 04 '23 23:10 bigwheel

I has created PR for this issue https://github.com/cloudposse/terraform-aws-tfstate-backend/compare/main...bigwheel:terraform-aws-tfstate-backend:support-terraoform-v16?expand=1 and already tested but I found just Generation of backend configuration file deprecated. I'm stucking.

bigwheel avatar Oct 05 '23 01:10 bigwheel

This is related to https://github.com/cloudposse/terraform-aws-tfstate-backend/issues/171

Let's keep the conversation going in there and I'm going to close this issue. We're likely to deprecate this generated config output as it likely shouldn't be in scope of this module. Please weigh in the comments in #171 if you've got anything you'd like to share!

Gowiem avatar Jul 04 '24 17:07 Gowiem