Skip to content

bug: dynamodb.UpdateContinuousBackups UnknownOperationException when using Terraform’s aws_dynamodb_table point_in_time_recovery #7569

@davecardwell

Description

@davecardwell

Is there an existing issue for this?

  • I have searched the existing issues

Replacement issue for #1197

Current Behavior

Terraform’s aws_dynamodb_table has a point_in_time_recovery attribute you can enable. Doing so with LocalStack results in AWS dynamodb.UpdateContinuousBackups => 400 (UnknownOperationException).

The table creation succeeds, but the overall terraform apply fails and Terraform considers it to be a tainted resource since the backup enabling operation failed.

Terraform output:

aws_dynamodb_table.example: Creating...
│ Error: creating Amazon DynamoDB Table (example): enabling point in time recovery: updating PITR: UnknownOperationException: An unknown operation was requested.
│ status code: 400, request id: UA1IUBFM6870CXD0XVRJ5S9DM37XSJ7FGNUCCYU2D5T251KKPQPE

LocalStack logs:

localstack_main | 2023-01-28T17:06:46.581 INFO --- [ asgi_gw_0] localstack.request.aws : AWS dynamodb.UpdateContinuousBackups => 400 (UnknownOperationException); UpdateContinuousBackupsInput({'TableName': 'example', 'PointInTimeRecoverySpecification': {'PointInTimeRecoveryEnabled': True}}, headers={'Host': 'localhost:4566', 'User-Agent': 'APN/1.0 HashiCorp/1.0 Terraform/1.3.7 (+https://www.terraform.io) terraform-provider-aws/4.52.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.44.186 (go1.19.3; darwin; arm64)', 'Content-Length': '94', 'Accept-Encoding': 'identity', 'Authorization': 'AWS4-HMAC-SHA256 Credential=test/20230128/us-east-1/dynamodb/aws4_request, SignedHeaders=accept-encoding;content-length;content-type;host;x-amz-date;x-amz-target, Signature=d6c195604c368dc559152d3f487f084e634b5ac8f163516ded43ed5540746e91', 'Content-Type': 'application/x-amz-json-1.0', 'X-Amz-Date': '20230128T170646Z', 'X-Amz-Target': 'DynamoDB_20120810.UpdateContinuousBackups', 'x-localstack-tgt-api': 'dynamodb', 'x-moto-account-id': '000000000000'}); UnknownOperationException(An unknown operation was requested., headers={'Content-Type': 'application/json', 'X-Amzn-Errortype': 'UnknownOperationException', 'Content-Length': '89', 'x-amzn-requestid': 'UA1IUBFM6870CXD0XVRJ5S9DM37XSJ7FGNUCCYU2D5T251KKPQPE', 'x-amz-crc32': '2902199822', 'Connection': 'close', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'HEAD,GET,PUT,POST,DELETE,OPTIONS,PATCH', 'Access-Control-Allow-Headers': 'authorization,cache-control,content-length,content-md5,content-type,etag,location,x-amz-acl,x-amz-content-sha256,x-amz-date,x-amz-request-id,x-amz-security-token,x-amz-tagging,x-amz-target,x-amz-user-agent,x-amz-version-id,x-amzn-requestid,x-localstack-target,amz-sdk-invocation-id,amz-sdk-request', 'Access-Control-Expose-Headers': 'etag,x-amz-version-id'})

Expected Behavior

I expect the operation to succeed. For my purposes I don’t need any actual change in behavior other than the setting being recorded and returned for future terraform applys.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

# using https://github.com/localstack/localstack/blob/master/docker-compose-pro.yml
DEBUG=true LS_LOG=trace-internal LOCALSTACK_API_KEY={redacted} docker compose up -d

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

terraform init
terraform apply

With the following config:

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
  }
}

provider "aws" {
  access_key = "test"
  secret_key = "test"
  region     = "us-east-1"

  s3_use_path_style           = true
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    acm      = "http://localhost:4566"
    dynamodb = "http://localhost:4566"
    sts      = "http://localhost:4566"
  }
}

resource "aws_dynamodb_table" "example" {
  name     = "example"
  hash_key = "test"
  attribute {
    name = "test"
    type = "S"
  }
  read_capacity  = 1
  write_capacity = 1

  point_in_time_recovery {
    enabled = true
  }
}

Environment

- OS: macOS Ventura 13.1 (22C65)
- Docker Desktop: 4.16.2 (95914
- LocalStack: 1.3.2.dev

Anything else?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions