Skip to content

[Bug]: aws_s3_directory_bucket — Missing Resource Identity After Read #47755

@markelliot

Description

@markelliot

Terraform and AWS Provider Version

hashicorp/aws v6.34.0

Affected Resource(s) or Data Source(s)

  • aws_s3_directory_bucket

Expected Behavior

terraform apply of a fresh aws_s3_directory_bucket resource should create the bucket and complete without error. Refresh of an existing one should populate state and identity cleanly.

Actual Behavior

Both Create-then-Read and refresh against an existing directory bucket fail with:

Error: Missing Resource Identity After Read

The Terraform Provider unexpectedly returned no resource identity data
after having no errors in the resource read. This is always an issue in
the Terraform Provider and should be reported to the provider developers.

The Read function returns no error and no identity, tripping the framework's identity assertion. This blocks all reconciliation — the resource never proceeds to Create or to a clean refresh.

Steps to Reproduce

  1. Apply a minimal config:

    resource "aws_s3_directory_bucket" "example" {
      bucket = "example-bucket--use1-az4--x-s3"
      location {
        name = "use1-az4"
        type = "AvailabilityZone"
      }
      data_redundancy = "SingleAvailabilityZone"
      type            = "Directory"
    }
  2. Run terraform apply (greenfield) — error fires before Create.

  3. Or, pre-create the bucket out of band with aws s3api create-bucket --bucket example-bucket--use1-az4--x-s3 --create-bucket-configuration '{"Location":{"Type":"AvailabilityZone","Name":"use1-az4"},"Bucket":{"Type":"Directory","DataRedundancy":"SingleAvailabilityZone"}}' and then terraform import aws_s3_directory_bucket.example example-bucket--use1-az4--x-s3 → next refresh hits the same error.

The bucket itself can be created and managed normally via the AWS CLI / SDK; the failure is purely the TF resource's identity contract.

Relevant Error/Panic Output

read resource request failed: Missing Resource Identity After Read: The
Terraform Provider unexpectedly returned no resource identity data after
having no errors in the resource read. This is always an issue in the
Terraform Provider and should be reported to the provider developers.

Notes

internal/service/s3/directory_bucket.go declares framework.WithImportByIdentity and is annotated @Testing(preIdentityVersion=\"v6.31.0\"), but the Read function does not appear to populate identity on the response, which appears to be the proximate cause. Comparable issues for sibling resources have been resolved by explicitly setting identity in Read — e.g. #46674 (aws_s3_bucket_lifecycle_configuration) and #46116 (security group). #45303 tracks the same class of bug for VPC SG rules and is still open.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.prioritizedPart of the maintainer teams immediate focus. To be addressed within the current quarter.regressionPertains to a degraded workflow resulting from an upstream patch or internal enhancement.resource-identityPertains to resource identity.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