Skip to content

6.35.0 Regression: LifecycleRuleAndOperator cannot be flattened #46761

@pcarn

Description

@pcarn

Terraform and AWS Provider Version

Terraform v1.14.6
on linux_amd64
+ provider registry.terraform.io/grafana/grafana v4.27.0
+ provider registry.terraform.io/hashicorp/aws v6.35.0
+ provider registry.terraform.io/hashicorp/external v2.3.5
+ provider registry.terraform.io/hashicorp/kubernetes v2.38.0
+ provider registry.terraform.io/hashicorp/random v3.8.1

Affected Resource(s) or Data Source(s)

  • aws_s3_bucket_lifecycle_configuration

Expected Behavior

terraform plan is successful

Actual Behavior

terraform plan errors with messages about Incompatible Types

This worked fine in 6.34.0, but started failing in 6.35.0

Relevant Error/Panic Output

Planning failed. Terraform encountered an error while generating this plan.

│ Error: Incompatible Types

│   with aws_s3_bucket_lifecycle_configuration.delete_certs_after_ninety_days,
│   on bucket.tf line 22, in resource "aws_s3_bucket_lifecycle_configuration" "delete_certs_after_ninety_days":
│   22: resource "aws_s3_bucket_lifecycle_configuration" "delete_certs_after_ninety_days" {

│ An unexpected error occurred while flattening configuration. This is always
│ an error in the provider. Please report the following to the provider
│ developer:

│ Source type
│ "*github.com/aws/aws-sdk-go-v2/service/s3/types.LifecycleRuleAndOperator"
│ cannot be flattened to target type
│ "github.com/hashicorp/terraform-provider-aws/internal/service/s3.lifecycleRuleAndOperatorModel".

Sample Terraform Configuration

Click to expand configuration
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "6.35.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

resource "aws_s3_bucket" "example" {
  bucket = "example-lifecycle-and-filter-bug-12345"
}

resource "aws_s3_bucket_lifecycle_configuration" "example" {
  bucket = aws_s3_bucket.example.id

  rule {
    id = "expire_after_ninety_days"
    filter {
      and {
        prefix                   = "certs/"
        object_size_greater_than = 1
      }
    }
    status = "Enabled"
    expiration {
      days = 90
    }
  }
}

Steps to Reproduce

terraform init
terraform plan

Debug Logging

Click to expand log output

GenAI / LLM Assisted Development

n/a

Important Facts and References

Regressed in 6.35.0

Would you like to implement a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.needs-triageWaiting for first response or review from a maintainer.service/s3Issues and PRs that pertain to the s3 service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions