Skip to content

bug: S3 CreateBucket fails with MalformedXML after upgrading Terraform AWS provider to v6.23 #13426

@jerry153fish

Description

@jerry153fish

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

After upgrading the Terraform AWS provider to v6.23, S3 bucket creation on LocalStack (latest stable) begins failing with a MalformedXML error. The same Terraform code works correctly with provider v6.22 and earlier.

This looks like a compatibility issue between the new provider version and LocalStack’s S3 API handling.

operation error S3: CreateBucket, https response error StatusCode: 400, 
RequestID: 698224bf-be00-49ba-b0c4-372feb40308b, 
HostID: s9lzHYrFp76ZVxRcpX9+5cjAnEH2ROuNkd2BHfIa6UkFVdtjf5mKR3/eTPFvsiP/XV/VLi31234=, 
api error MalformedXML: The XML you provided was not well-formed or did not validate against our published schema
Environment

Terraform AWS Provider: v6.23.0

Terraform CLI: 1.5.7

LocalStack: latest

LocalStack runtime: Docker

OS: macOS

Minimal Terraform Configuration to Reproduce

provider "aws" {
  access_key                  = "test"
  secret_key                  = "test"
  region                      = "us-east-1"
  s3_use_path_style           = false
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    apigateway     = "http://localhost:4566"
    apigatewayv2   = "http://localhost:4566"
    cloudformation = "http://localhost:4566"
    cloudwatch     = "http://localhost:4566"
    dynamodb       = "http://localhost:4566"
    ec2            = "http://localhost:4566"
    es             = "http://localhost:4566"
    elasticache    = "http://localhost:4566"
    firehose       = "http://localhost:4566"
    iam            = "http://localhost:4566"
    kinesis        = "http://localhost:4566"
    lambda         = "http://localhost:4566"
    rds            = "http://localhost:4566"
    redshift       = "http://localhost:4566"
    route53        = "http://localhost:4566"
    s3             = "http://s3.localhost.localstack.cloud:4566"
    secretsmanager = "http://localhost:4566"
    ses            = "http://localhost:4566"
    sns            = "http://localhost:4566"
    sqs            = "http://localhost:4566"
    ssm            = "http://localhost:4566"
    stepfunctions  = "http://localhost:4566"
    sts            = "http://localhost:4566"
  }
}

resource "aws_s3_bucket" "test" {
  bucket = "my-test-bucket"
}

Steps:

  • Start LocalStack
  • Run terraform init
  • Run terraform apply
  • Observe the MalformedXML error during CreateBucket

Expected Behavior

Bucket should be created successfully, as it does with provider v6.22 and earlier.

Actual Behavior

CreateBucket API returns 400 MalformedXML, causing Terraform apply to fail.

How are you starting LocalStack?

With a docker-compose file

version: "3.8"
services:
  localstack:
    image: localstack/localstack:latest
    ports:
      - 4566:4566
      - 4571:4571

Anything else?

No response

Metadata

Metadata

Assignees

Labels

aws:s3Amazon Simple Storage Servicestatus: resolved/fixedResolved with a fix or an implementationtype: bugBug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions