Terraform-provider-aws: Add support for DynamoDB attribute type - Boolean

Created on 13 Jun 2017  ·  9Comments  ·  Source: hashicorp/terraform-provider-aws

_This issue was originally opened by @tarakan12 as hashicorp/terraform#12569. It was migrated here as part of the provider split. The original body of the issue is below._


Attribute type does not support boolean at the moment

Affected Resource(s)

  • aws_dynamodb_table

References

enhancement

Most helpful comment

type 'BOOL' is not supported.
I set a range key to be an attribute which is of BOOL

  • aws_dynamodb_table.RO-dynamodb: AWS Error creating DynamoDB table: ValidationException: 1 validation error detected: Value 'BOOL' at 'attributeDefinitions.4.member.attributeType' failed to satisfy constraint: Member must satisfy enum value set: [B, N, S]

All 9 comments

Hi @tarakan12

As far as I checked, you can only set BOOL, SS, BS, L, M, NS, NULL for attributes that are not related to primary / range keys.
Missing attribute types can be set when putting an item to the DB, but not on the required schema. Also found this (https://forums.aws.amazon.com/thread.jspa?messageID=613970) which exposes the idea.

I will close this issue if you don't mind, since there is nothing we can do, as the API is restricting us at time. Feel free to comment if I miss anything: I will be more than happy to help / reopen! 😄

type 'BOOL' is not supported.
I set a range key to be an attribute which is of BOOL

  • aws_dynamodb_table.RO-dynamodb: AWS Error creating DynamoDB table: ValidationException: 1 validation error detected: Value 'BOOL' at 'attributeDefinitions.4.member.attributeType' failed to satisfy constraint: Member must satisfy enum value set: [B, N, S]

Is it normal the issue is closed ? I have the same problem for to use M (Map type).

According to https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey:

Each primary key attribute must be a scalar (meaning that it can hold only a single value). The only data types allowed for primary key attributes are string, number, or binary. There are no such restrictions for other, non-key attributes.

Only range/hash key attributes should need to be defined in Terraform; you should not need to declare your schema fully.

@gbergere Yes this is still an issue.

@bflad Yes the issue is regarding a range attribute

It is not clear if you need or not need to specify all of your attributes. Half of the internet has example code where the complete schema is defined and Terraform does not support BOOL types at all.

+1 on this, to @bflad the combination of the Primary key (the hash and range key) has too be unique. It is therefor valid to set the Hash key to a bool, and the range key to a N as an example.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings