Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: DynamoDB Table attribute Invalid value: "boolean" #1261

Open
1 task done
zargor opened this issue Apr 10, 2024 · 3 comments
Open
1 task done

[Bug]: DynamoDB Table attribute Invalid value: "boolean" #1261

zargor opened this issue Apr 10, 2024 · 3 comments
Labels

Comments

@zargor
Copy link

zargor commented Apr 10, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Affected Resource(s)

dynamodb.aws.upbound.io/v1beta1 - Table

https://marketplace.upbound.io/providers/upbound/provider-aws-dynamodb/v1.3.1/resources/dynamodb.aws.upbound.io/Table/v1beta1

Resource MRs required to reproduce the bug

apiVersion: dynamodb.aws.upbound.io/v1beta1
kind: Table
metadata:
  annotations:
    meta.upbound.io/example-id: dynamodb/v1beta1/table
  name: example
spec:
  forProvider:
    attribute:
      - name: UserId
        type: S
      - name: GameTitle
        type: S
      - name: TopScore
        type: N
    billingMode: PROVISIONED
    globalSecondaryIndex:
      - hashKey: GameTitle
        name: GameTitleIndex
        nonKeyAttributes:
          - UserId
        projectionType: INCLUDE
        rangeKey: TopScore
        readCapacity: 10
        writeCapacity: 10
    hashKey: UserId
    rangeKey: GameTitle
    readCapacity: 20
    region: us-west-1
    tags:
      Environment: production
      Name: dynamodb-table-1
    writeCapacity: 20

Steps to Reproduce

Apply the MR manifest. The result would be:

The Table "example" is invalid: spec.forProvider.attribute[2].type: Invalid value: "boolean": spec.forProvider.attribute[2].type in body must be of type string: "boolean"

However, when 'N'is provided instead N it is working.

Now, in case DynamoDB Table is part of a composition (based on KCL function, not P&T), then no matter how value "N" (number) is provided, quoted or not, the process ends up with error.

What happened?

From a composition, expected is to have DynamoDB Table provisioned.
It turns out that if one has an attribute of type number (N), the resource will never get provisioned due to an error.

Relevant Error Output Snippet

cannot compose resources: cannot apply composed resource "example": failed to create typed patch object (/example; dynamodb.aws.upbound.io/v1beta1, Kind=Table): .spec.forProvider.attribute[2].type: expected string, got &value.valueUnstructured{Value:false}


### Crossplane Version

v1.14.5

### Provider Version

v1.3.1

### Kubernetes Version

v1.27.11

### Kubernetes Distribution

EKS

### Additional Info

This does not happen with P&T composition, but with KCL function based composition.
@Peefy
Copy link

Peefy commented Apr 19, 2024

Hello @zargor Thank you for your feedback. I have fixed it in function-kcl v0.5.4 with the PR: crossplane-contrib/function-kcl#79

@zargor
Copy link
Author

zargor commented May 7, 2024

Awesome! It works.

@turkenf
Copy link
Collaborator

turkenf commented May 9, 2024

Hi @zargor, thank you for the issue, I think it works as expected on the provider side, do you still think this is a valid issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants