Skip to content

aws_s3_object idempotency issue #44356

@quentin9696

Description

@quentin9696

Terraform and AWS Provider Version

Terraform v1.13.3
on linux_amd64
+ provider registry.terraform.io/hashicorp/aws v6.13.0

Affected Resource(s) or Data Source(s)

  • aws_s3_object

Expected Behavior

Attribute and argument consistent when apply twice

Actual Behavior

TF show the following diff

      ~ metadata                      = null -> {}
      ~ tags                          = null -> {}
      ~ version_id                    = "" -> "null"

Please note that version_id isn't affected if the bucket version is disabled

Relevant Error/Panic Output

  ~ aws_s3_object = {
        id                            = "mybucket"
      ~ metadata                      = null -> {}
      ~ tags                          = null -> {}
      ~ version_id                    = "" -> "null"
        # (32 unchanged attributes hidden)
    }

Sample Terraform Configuration

Click to expand configuration
provider "aws" {
  region = "us-east-1"
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 6"
    }
  }
}

resource "aws_s3_bucket" "this" {
  bucket = "mybucket"
  force_destroy = true
}

resource "aws_s3_bucket_versioning" "this" {
  bucket = aws_s3_bucket.this.id
  versioning_configuration {
    status = "Enabled"
  }
}

resource "aws_s3_object" "this" {
  bucket = aws_s3_bucket.this.id
  key    = "foo"
  content = "foo"
}

output "aws_s3_object" {
  value = aws_s3_object.this
}

Steps to Reproduce

  1. Apply
  2. Apply a second time without any modification

Debug Logging

No response

GenAI / LLM Assisted Development

n/a

Important Facts and References

No response

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