crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

[Bug]: Cannot create a AWS Keyspaces Table with 'PROVISIONED' throughput mode #1303

Closed fgiannetti closed 1 month ago

fgiannetti commented 1 month ago

Is there an existing issue for this?

Affected Resource(s)

tables.keyspaces.aws.upbound.io

Resource MRs required to reproduce the bug

apiVersion: keyspaces.aws.upbound.io/v1beta1
kind: Table
metadata:
  name: testkeyspace-table
spec:
  forProvider:
    keyspaceNameRef:
      name: testkeyspace
    region: us-east-1
    capacitySpecification:
      - throughputMode: PROVISIONED
      - readCapacityUnits: 1000
      - writeCapacityUnits: 1000
    schemaDefinition:
      - column:
          - name: id
            type: int
          - name: name
            type: ascii
        partitionKey:
          - name: id
    tableName: people
  providerConfigRef:
    name: keyspaces-provider-config

Steps to Reproduce

What happened?

The resource is never created in AWS because the AWS api return the error:

ValidationException: 'PROVISIONED' throughput mode requires 'read_capacity_units' and 'write_capacity_units' to be set using 'capacity_mode' option

If I run a describe of the Table, the read_capacity_units and write_capacity_units values are setted.

Relevant Error Output Snippet

The describe of the local Table resource (`kubectl describe table testkeyspaces-people`):

Spec:
  Deletion Policy:  Delete
  For Provider:
    Capacity Specification:
      Throughput Mode:       PROVISIONED
      Read Capacity Units:   1000
      Write Capacity Units:  1000
    Keyspace Name:           testkeyspace
    Keyspace Name Ref:
      Name:  testkeyspace
    Region:  us-east-1
    Schema Definition:
      Column:
        Name:  id
        Type:  int
        Name:  name
        Type:  ascii
      Partition Key:
        Name:    id
    Table Name:  people
    Tags:
      Crossplane - Kind:            table.keyspaces.aws.upbound.io
      Crossplane - Name:            testkeyspace-people
      Crossplane - Providerconfig:  keyspaces-provider-config
  Init Provider:
  Management Policies:
    *
  Provider Config Ref:
    Name:  keyspaces-provider-config
Status:
  At Provider:
  Conditions:
    Last Transition Time:  2024-05-08T16:36:33Z
    Reason:                Creating
    Status:                False
    Type:                  Ready
    Last Transition Time:  2024-05-08T16:36:33Z
    Message:               create failed: async create failed: failed to create the resource: [{0 creating Keyspaces Table (testkeyspace/people): operation error Keyspaces: CreateTable, https response error StatusCode: 400, RequestID: d4d855ce-f5a9-4177-b789-6d445bea2c7b, ValidationException: 'PROVISIONED' throughput mode requires 'read_capacity_units' and 'write_capacity_units' to be set using 'capacity_mode' option.  []}]
    Reason:                ReconcileError
    Status:                False
    Type:                  Synced
    Last Transition Time:  2024-05-08T16:36:33Z
    Message:               async create failed: failed to create the resource: [{0 creating Keyspaces Table (testkeyspace/people): operation error Keyspaces: CreateTable, https response error StatusCode: 400, RequestID: d4d855ce-f5a9-4177-b789-6d445bea2c7b, ValidationException: 'PROVISIONED' throughput mode requires 'read_capacity_units' and 'write_capacity_units' to be set using 'capacity_mode' option.  []}]
    Reason:                AsyncCreateFailure
    Status:                False
    Type:                  LastAsyncOperation
Events:
  Type    Reason                   Age              From                                                  Message
  ----    ------                   ----             ----                                                  -------
  Normal  CreatedExternalResource  9s               managed/keyspaces.aws.upbound.io/v1beta1, kind=table  Successfully requested creation of external resource
  Normal  PendingExternalResource  4s (x2 over 8s)  managed/keyspaces.aws.upbound.io/v1beta1, kind=table  Waiting for external resource existence to be confirmed

Crossplane Version

1.14.5

Provider Version

1.4.0

Kubernetes Version

1.26

Kubernetes Distribution

EKS

Additional Info

The creation of the Keyspace and another tables with 'PAY_PER_REQUEST' are created just fine! 😉

fgiannetti commented 1 month ago

Well, searching the Terraform documentation I found that the correct manifest should be:

capacitySpecification:
  - throughputMode: PROVISIONED
    readCapacityUnits: 1000
    writeCapacityUnits: 1000

Close the issue Thanks!!